Porting C# code

BCS none at anon.com
Thu Jan 7 10:45:23 PST 2010


Hello Brien,

> Hi BCS,
> 
> I'd really appreciate it.  I'm looking to port over a network server
> application so the GUI stuff shouldn't be a problem.  I've also kept
> my source code on C# 1.0 so hopefully that should make it easier.

IIRC it targets c# 2.0 or there about (no LINQ)

> 
> Did you write your own parser or base it on ANTLR or some other
> parsing/compiling library?

I took the cheap solution of a state machine and per-line regex.

> 
> I wonder if it is possible to fully automate the conversion process-
> if you limit yourself to a certain subset of C# and maybe do some
> tricks to decorate the C# source code with any additional D keywords
> you would need, e.g. in C#
> 
> public class Foo {
> public /* @shared */ int bar;
> }
> which could get translated as a shared variable.
> 

The output is D 1.0

> I might want to continue to primarily write code in C# but create an
> optimized port to D where I would be able to use native techniques on
> critical areas of the code.

That might be viable but the system was never intended for speed (its intent 
was as a way to escape needing Mono on a non Windows system) so you would 
be stuck having to write D code in C#. 

I'll look into digging it out.





More information about the Digitalmars-d mailing list