www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - C# to D Compiler :)

reply "Ronald Adonyo" <ronald.adonyo gmail.com> writes:
Hi Everyone,
In my spare time over the last 3 weeks, I've been working on a C# 
to D Compiler based on Roslyn.
Please check it out and give comments. I would also like this to 
be a basis to provide both Libraries in D and allow building 
native C# applications with the help of D.

Its available on my github
https://github.com/afrogeek/SharpNative
Dec 18 2014
next sibling parent reply "Ronald Adonyo" <ronald.adonyo gmail.com> writes:
This is the Current Feature List

Basic PInvoke
Arrays including initializers
Fields/ Properties/Methods with correct hiding semantics
Properties are better implemented
String
Int/Double/Bool
Classes and Polymorphism … we follow C# model
Some benchmarks - basic linpack, fannkuch, nbody
Modules/Namespaces
Enum - no enum.Parse support yet though
Iterators are as .Net use enumerators etc … switching arrays to 
use simple for loop though for performance improvement
Constructors/Overloads/Base Class calls
Static Variables/Members/Properties
Basic System.Math, more implementations required though
Extension Methods
Operator Overloading
Indexers
Anonymous Classes
Generics … All current test cases work
Boxed structs and interface casting for them
Inner Classes in the form of OuterClass_InnerClass
Static Constructors
Explicit Interfaces … current fix is not so pretty though … i.e. 
IEnumerator.MoveNext becomes IEnumerator.IEnumerator_MoveNext 
(this allows implementing methods with same name, differently)
Implicit and Explicit Cast Operators
String switch … dlang supports this natively :)
String.Format .. though implementation is very basic
C# multi dimensional arrays work correctly (even with multi dim 
syntax :) )… mostly … look at multi test from CrossNet
Delegates work including multicast (Native delegates through 
P/Invoke work too)
Events work as expected … though a bit slower than C#(mono)
Dec 18 2014
next sibling parent "Dicebot" <public dicebot.lv> writes:
On Thursday, 18 December 2014 at 23:58:30 UTC, Ronald Adonyo 
wrote:
 This is the Current Feature List

 ...
Looks intriguing :)
Dec 19 2014
prev sibling next sibling parent "ZombineDev" <valid_email he.re> writes:
Well done! I also thought of making a C# to D compiler using 
Roslyn, so I'm glad to see fruits of your labour :)


On Thursday, 18 December 2014 at 23:58:30 UTC, Ronald Adonyo 
wrote:
 This is the Current Feature List
Dec 19 2014
prev sibling parent reply "ZombineDev" <valid_email he.re> writes:
One example of a somewhat large performance oriented C# 
application is OpenRA[1].
(An open-source implementation of the Command & Conquer: Red 
Alert engine using .NET/Mono and OpenGL. Runs on Windows, Linux 
and Mac OS X)

It is interesting to see how far it can be translated from C# to 
D and what the performance would be.

I'll give it a shot when I have the time, though you may also 
find it useful as a way to benchmark your compiler ;)


[1]: https://github.com/OpenRA/OpenRA
Dec 21 2014
parent "Kiith-Sa" <kiithsacmp gmail.com> writes:
On Sunday, 21 December 2014 at 15:12:26 UTC, ZombineDev wrote:
 One example of a somewhat large performance oriented C# 
 application is OpenRA[1].
 (An open-source implementation of the Command & Conquer: Red 
 Alert engine using .NET/Mono and OpenGL. Runs on Windows, Linux 
 and Mac OS X)

 It is interesting to see how far it can be translated from C# 
 to D and what the performance would be.

 I'll give it a shot when I have the time, though you may also 
 find it useful as a way to benchmark your compiler ;)


 [1]: https://github.com/OpenRA/OpenRA
Last time (long ago) I looked at OpenRA code it didn't look like its source would (directly) translate well to high-performance D/C++/whatever. You'd end up needing to turn some structs to classes, limit GC usage (.NET has a much better GC, yet non-GC code is simpler in D), etc. (I'm planning to work on a project with similar goals to OpenRA, although for academic reasons I'm still only working on its entity system (https://github.com/kiith-sa/tharsis-core).
Dec 21 2014
prev sibling next sibling parent "Stefan Koch" <uplink.coder googlemail.com> writes:
On Thursday, 18 December 2014 at 23:56:54 UTC, Ronald Adonyo 
wrote:
 Hi Everyone,
 In my spare time over the last 3 weeks, I've been working on a 
 C# to D Compiler based on Roslyn.
 Please check it out and give comments. I would also like this 
 to be a basis to provide both Libraries in D and allow building 
 native C# applications with the help of D.

 Its available on my github
 https://github.com/afrogeek/SharpNative
Nice Work!
Dec 18 2014
prev sibling next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2014-12-19 00:56, Ronald Adonyo wrote:
 Hi Everyone,
 In my spare time over the last 3 weeks, I've been working on a C# to D
 Compiler based on Roslyn.
 Please check it out and give comments. I would also like this to be a
 basis to provide both Libraries in D and allow building native C#
 applications with the help of D.

 Its available on my github
 https://github.com/afrogeek/SharpNative
This is pretty cool. When the tool is good enough, then you can run the tool the Roslyn compiler and on itself. Then you'll have a C# compiler and a tool to translate from C# to D, written in D :) BTW, you should add .DS_Store to .gitignore. -- /Jacob Carlborg
Dec 18 2014
parent reply "Ronald Adonyo" <ronald.adonyo gmail.com> writes:
On Friday, 19 December 2014 at 07:39:24 UTC, Jacob Carlborg wrote:
 On 2014-12-19 00:56, Ronald Adonyo wrote:
 Hi Everyone,
 In my spare time over the last 3 weeks, I've been working on a 
 C# to D
 Compiler based on Roslyn.
 Please check it out and give comments. I would also like this 
 to be a
 basis to provide both Libraries in D and allow building native 
 C#
 applications with the help of D.

 Its available on my github
 https://github.com/afrogeek/SharpNative
This is pretty cool. When the tool is good enough, then you can run the tool the Roslyn compiler and on itself. Then you'll have a C# compiler and a tool to translate from C# to D, written in D :) BTW, you should add .DS_Store to .gitignore.
Thanks, Jacob and Stefan, Done, does anyone have a good idea of how to write Async/Await using fibers or state machines in D ? I have yield return working, and would like to have both these as lambdas passed to library functions. Regards, Ron.
Dec 19 2014
parent "Kagamin" <spam here.lot> writes:
On Friday, 19 December 2014 at 08:11:42 UTC, Ronald Adonyo wrote:
 Done, does anyone have a good idea of how to write Async/Await 
 using fibers or state machines in D ?
Same as in .net, look at the generated IL, an async method should return a chain of tasks.
Dec 19 2014
prev sibling next sibling parent "FrankLike" <1150015857 qq.com> writes:
On Thursday, 18 December 2014 at 23:56:54 UTC, Ronald Adonyo 
wrote:
 Hi Everyone,
 In my spare time over the last 3 weeks, I've been working on a 
 C# to D Compiler based on Roslyn.
 Please check it out and give comments. I would also like this 
 to be a basis to provide both Libraries in D and allow building 
 native C# applications with the help of D.

 Its available on my github
 https://github.com/afrogeek/SharpNative
Nice work.
Dec 19 2014
prev sibling parent "FrankLike" <1150015857 qq.com> writes:
On Thursday, 18 December 2014 at 23:56:54 UTC, Ronald Adonyo 
wrote:
 Hi Everyone,
 In my spare time over the last 3 weeks, I've been working on a 
 C# to D Compiler based on Roslyn.
 Please check it out and give comments. I would also like this 
 to be a basis to provide both Libraries in D and allow building 
 native C# applications with the help of D.

 Its available on my github
 https://github.com/afrogeek/SharpNative
If use the .Net Framework 4.0,it's will better than now,a lot of people will test it,but v4.5.3,maybe a little.
Dec 21 2014