Page 1 of 2
Who wants to devolop a native C# compiler together ?
Posted: Tue Dec 30, 2008 8:15 am
by engine252
Someone was asking to develop a c compiler but since there are more than enough c compiler out there, I don't want to add another one.
My idea is to develop a native compiler for the c# programming language.
I know there are some projects out there doing il to asm.
But i never looked at there code so i don't know how much they are tied to the .net runtime or the os.
There's
BARTOK compiler (closed source) --> in singulartity
AOT compiler --> COSMOS
AOT compiler --> SharpOS
maybe there are some more i don't know about ... anyway,
i've seen that the AOT compilers do something strange with the system.dll maybe it's perfectly normal what they do but I'd like to find out by writing a compiler myself.
The idea is to develop the compiler so i can develop a OS with that compiler.
My language of choice would be Microsoft c# so i can port the compiler to the operating system at a later stage without having to re implement the thing.
If anyone is interested in participating
contact me.
Re: Who wants to devolop a native C# compiler together ?
Posted: Tue Dec 30, 2008 12:07 pm
by DeletedAccount
Have you even tried searching on Ngen ??? Anways i would love to be a part of such a project , but now am under lots of time constraints.
Regards
Shrek
Re: Who wants to devolop a native C# compiler together ?
Posted: Tue Dec 30, 2008 3:48 pm
by engine252
ngen precompiles a .net assembly and stores a image of this compilation in the assembly.
Or something like that, i never really looked in it very deeply but it can not be used for os development.
At least you can't build the entire os with the c# compiler together with ngen.
You would have to create a .net runtime that runs natively on a machine, in that case a native compiler would be redundant.
But then again people who can participate are all welcome even if you can only look at some code and advise or comment.
The problem is there's no real forums for people looking into compilers.
If you know of Forums or communities on this subject please tell me about it.
Re: Who wants to devolop a native C# compiler together ?
Posted: Thu Jan 01, 2009 1:14 am
by michael1234
I would be very interested in helping with this project. Though C# isn't really designed as a native language, how are you planning on implementing these kind of features? Such as garbage collection. With .net, all of the threads of the program are halted for garbage collection to take place. This is absolutely not a good idea for an operating system. There are a few other things, like how to inline asm, etc. Which means the compiler isn't really compiling c#, rather a similar language.
Re: Who wants to devolop a native C# compiler together ?
Posted: Thu Jan 01, 2009 5:59 pm
by engine252
The idea is to implement the language as good as possible but
indeed there are features that aren't possible without a framework or runtime of some sort.
Inline assembler shouldn't be much of a problem since i am planning to generate assembler, it wouldn't even break with the current c# standards.
I'm not really sure on how to implement the garbage collection, i think creating a runtime can solve this and then later on i can port this runtime to my Os.
Re: Who wants to devolop a native C# compiler together ?
Posted: Sun Mar 08, 2009 5:05 am
by redoktober
hmm..
i don't think i'll be able to help much.
but do check out rotor.
something shrek told me about.
microsoft has released most of the specifications for the .net runtime under project rotor.
it makes sense that you write your own runtime, and then port it into the kernel...that's what i'm planning to do for my os, anyway...
if you don't mind, do let me know how this goes...good luck!
Re: Who wants to devolop a native C# compiler together ?
Posted: Sun Mar 08, 2009 10:25 am
by CoryG
Not trying to hijack your thread - but wanna do the compiler for this
http://forum.osdev.org/viewtopic.php?f=2&t=19353 project?
Re: Who wants to devolop a native C# compiler together ?
Posted: Sun Mar 08, 2009 6:49 pm
by AndrewAPrice
Another D compiler would be awesome. Think of D as a native C#, just with FAAAAR more features and it's a systems and applications programming language (in other words, it has everything built in to support OSdev!)
Re: Who wants to devolop a native C# compiler together ?
Posted: Mon Mar 09, 2009 12:03 am
by Steve the Pirate
Native C# compiler is a bit of an oxymoron, isn't it? Still, it would be cool to have something like Vala that could be used for OS dev. For those who haven't seen it before, Vala is a language that is a lot like C# that compiles into C code, and compiles that into a native executable. It's designed for GTK and GObject, so would not be of any use in OS Dev, but a language like it (you'd probably want to compile to C++ or D to get proper object oriented programming) would be pretty cool.
Re: Who wants to devolop a native C# compiler together ?
Posted: Mon Mar 09, 2009 1:06 am
by ru2aqare
Steve the Pirate wrote:Native C# compiler is a bit of an oxymoron, isn't it? Still, it would be cool to have something like Vala that could be used for OS dev. For those who haven't seen it before, Vala is a language that is a lot like C# that compiles into C code, and compiles that into a native executable.
Actually, we are working on something like that - compiling C# to C code.
Re: Who wants to devolop a native C# compiler together ?
Posted: Tue Mar 10, 2009 2:15 am
by michael1234
Steve the Pirate wrote:Native C# compiler is a bit of an oxymoron, isn't it?
How so?
The JIT compiler for .NET on Windows basically runs like this (although granted it has a lot of virtual machine and other runtime stuff).
Re: Who wants to devolop a native C# compiler together ?
Posted: Tue Mar 10, 2009 9:42 am
by 01000101
I don't have the expertise to work on this project, but I do think it's a good idea.
The distant thought of developing an OS in Visual C# 2008 is very appealing.
Re: Who wants to devolop a native C# compiler together ?
Posted: Tue Mar 10, 2009 7:38 pm
by NReed
MessiahAndrw wrote:Another D compiler would be awesome. Think of D as a native C#, just with FAAAAR more features and it's a systems and applications programming language (in other words, it has everything built in to support OSdev!)
.. You need to either learn more about C# or stop reading the D docs. I know D has a couple of beautiful syntax sugars, but uh, C# has way more features. The OO features of D are weak in comparison to C#. D is a wonderful start, but it needs to complete the job first.
Re: Who wants to devolop a native C# compiler together ?
Posted: Fri Mar 13, 2009 12:28 am
by AndrewAPrice
NReed wrote:MessiahAndrw wrote:Another D compiler would be awesome. Think of D as a native C#, just with FAAAAR more features and it's a systems and applications programming language (in other words, it has everything built in to support OSdev!)
.. You need to either learn more about C# or stop reading the D docs. I know D has a couple of beautiful syntax sugars, but uh, C# has way more features. The OO features of D are weak in comparison to C#. D is a wonderful start, but it needs to complete the job first.
I've used C# for some time now (mostly for GUI prototyping, also ported some games from C++ to C# (compact .Net on Xbox 360) until my free 12-month XNA membership expired).
Off the top of my head C# lacks the raw templating power of D aswell as array slicing. It also encourages odd coding practices, for example in the XNA tutorials you see ".. + new Vector3(0,4,5) + ... * new Matrix(new Vector3(1,1,0), new Vector3(0,1,1), new Vector3(0,0,1))" inserted in the middle of equations that could be ran per object per frame. I know the GC may be fast, but still...
Can you please give me a specific case (or several) of when the OO features of D are weak in comparison to C#?
Re: Who wants to devolop a native C# compiler together ?
Posted: Fri Mar 13, 2009 3:11 pm
by michael1234
MessiahAndrw wrote:
Off the top of my head C# lacks the raw templating power of D aswell as array slicing. It also encourages odd coding practices, for example in the XNA tutorials you see ".. + new Vector3(0,4,5) + ... * new Matrix(new Vector3(1,1,0), new Vector3(0,1,1), new Vector3(0,0,1))" inserted in the middle of equations that could be ran per object per frame. I know the GC may be fast, but still...
Both Matrix and Vector3 are structures, not classes. Their "new" operator is more of a language feature, and AFAIK they do not even go through the GC system and are allocated on the stack, when designing a new compiler (i'm not sure if the existing Microsoft one does this) it would be very possible to optimize away even that..