Who wants to devolop a native C# compiler together ?

This forums is for OS project announcements including project openings, new releases, update notices, test requests, and job openings (both paying and volunteer).
engine252
Posts: 6
Joined: Mon May 19, 2008 11:27 am
Location: Belgium

Who wants to devolop a native C# compiler together ?

Post 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.
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Re: Who wants to devolop a native C# compiler together ?

Post 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
engine252
Posts: 6
Joined: Mon May 19, 2008 11:27 am
Location: Belgium

Re: Who wants to devolop a native C# compiler together ?

Post 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.
michael1234
Posts: 7
Joined: Sat Mar 29, 2008 5:31 pm

Re: Who wants to devolop a native C# compiler together ?

Post 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.
engine252
Posts: 6
Joined: Mon May 19, 2008 11:27 am
Location: Belgium

Re: Who wants to devolop a native C# compiler together ?

Post 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.
redoktober
Member
Member
Posts: 109
Joined: Thu Feb 26, 2009 12:58 am
Location: Gurgaon/New Delhi, India
Contact:

Re: Who wants to devolop a native C# compiler together ?

Post 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!
"Do you program in Assembly?" she asked. "NOP," he said.

"Intel Inside" is a Government Warning required by Law.
CoryG
Posts: 8
Joined: Sat Mar 07, 2009 8:14 am
Location: California
Contact:

Re: Who wants to devolop a native C# compiler together ?

Post 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?
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Re: Who wants to devolop a native C# compiler together ?

Post 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!)
My OS is Perception.
User avatar
Steve the Pirate
Member
Member
Posts: 152
Joined: Fri Dec 15, 2006 7:01 am
Location: Brisbane, Australia
Contact:

Re: Who wants to devolop a native C# compiler together ?

Post 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.
My Site | My Blog
Symmetry - My operating system.
ru2aqare
Member
Member
Posts: 342
Joined: Fri Jul 11, 2008 5:15 am
Location: Hungary

Re: Who wants to devolop a native C# compiler together ?

Post 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.
michael1234
Posts: 7
Joined: Sat Mar 29, 2008 5:31 pm

Re: Who wants to devolop a native C# compiler together ?

Post 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).
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

Re: Who wants to devolop a native C# compiler together ?

Post 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. :D
NReed
Posts: 24
Joined: Wed May 28, 2008 10:56 pm

Re: Who wants to devolop a native C# compiler together ?

Post 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.
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Re: Who wants to devolop a native C# compiler together ?

Post 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... :shock:

Can you please give me a specific case (or several) of when the OO features of D are weak in comparison to C#?
My OS is Perception.
michael1234
Posts: 7
Joined: Sat Mar 29, 2008 5:31 pm

Re: Who wants to devolop a native C# compiler together ?

Post 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... :shock:
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..
Post Reply