With what language was C# created

  • Thread starter Thread starter Sam Sungshik Kong
  • Start date Start date
S

Sam Sungshik Kong

Hi!

This might be a stupid question.
With what language was C# compiler created?
I guess assembly.
Or C?

I am just curious.

Sam
 
Sam Sungshik Kong said:
Hi!

This might be a stupid question.
With what language was C# compiler created?
I guess assembly.
Or C?

Probably C++, and then C#.
 
Bob Powell said:
I spoke with Anders Hjelsberg one time and he said with somewhat of a wry
smile that the C# compiler was actually written in C#.

ISTR a story I've heard once about the Pascal compiler (the first one) which
was written on paper, and then the author run the compiler through the
compiler (in its head) to compile.
 
Sort of a Chicken and Egg problem isn't it. When you think about it, it
does not really matter. The language is just a specification. So you have
a bunch of text in a file that needs to get compiled into IL. So if you had
nothing better to do, I guess you could write a C# compiler in Perl or even
DOS batch language to output the IL. Is the cs compiler written in C#?
Don't know for sure, but some have suggested it is. Cheers!
 
Hi.

I'm quite sure that the C# compiler is written in C++ (it's unmanaged code,
however). In particular, if you go to the folder that contains the csc.exe
executable, you will find that the main part of the compiler is in the
unmanaged DLL cscomp.dll. In the same folder you will find a managed wrapper
for cscomp.dll, which is called cscompmgd.dll, that contains some types of
the Microsoft.CSharp namespace.

However, it's true that some compilers are written in the same language they
compile. Apart from the C/C++ compilers (quite obviously) the Garden Point
Component Pascal compiler (by John Gough), for example, is written in
Component Pascal.

Have a nice day
GV
 
IIRC, the MS C# compiler was written in C++(isn't there an example CSC in
rotor?), probably based off of a grammer run through bison or something. The
Mono C# compiler(and most of mono itself) is written in C#, originally using
MS's C# compiler, however it compiles itself now.
Future C# compilers can easily be writtenin C#(it's unlikely MS will switch
though), though for new languages targetting the framework, C# seems ideal.
 
The Visual C# compiler is written in C++. We could have written it in C#,
bootstrapping our way up, but because that is much more time consuming and
difficult, we elected to stick with C++. We may revisit that in the future.

The JScript compiler is written in C#.

--
Eric Gunnerson

Visit the C# product team at http://www.csharp.net
Eric's blog is at http://blogs.gotdotnet.com/ericgu/

This posting is provided "AS IS" with no warranties, and confers no rights.
 
The C# compiler for the Mono project is written in C# so why couldn't
Microsoft's be written in C#. The .Net frameworks class
System.Reflection.Emit handles most of the issues for creating the IL code.
 
Well, the mono compiler was originally compiled with the MS compiler(IIRC),
what exactly would they compile css with?(or for that matter,
System.Reflection.Emit...that may not be written in C++ either, I don't know
off hand).
 
Leon Lambert said:
The C# compiler for the Mono project is written in C# so why couldn't
Microsoft's be written in C#. The .Net frameworks class
System.Reflection.Emit handles most of the issues for creating the IL
code.

Well, I haven't said "it's not possible to create a C# compiler in C#". I
knew that the mono C# compiler is written in C#.
I only pointed out that at the moment the C# compiler from Microsoft is
written in C++.

Have a nice day
GV
 
Back
Top