42

Was C# compiler written in C++?

0

5 Answers 5

36

Yes, but there are plans to write a C# compiler in C#, which I believe was discussed in this podcast.

Sign up to request clarification or add additional context in comments.

17 Comments

@Josh: the previous version of the compiler. It's iterative, not recursive. They're not using the same version of the compiler to compile itself. Rather, they implement the next version of the compiler using the previous version.
Nothing unusual about that. A large fraction of "serious" languages are eventually bootstrapped to be self hosting.
It is called Bootstrapping and it is fairly common to have a compiler written in the languages own language. It is usually a matter of pride as well and marks a major milestone for the language. en.wikipedia.org/wiki/Bootstrapping_(compilers)
To add a real world example that makes sense, Would it be wrong to use last years model of power screwdriver to assemble this years model?
This post is aging. Is C# compiler written in C# a reality now (.Net)?
|
23

Yes.

The Mono C# compiler is written in C#.

1 Comment

Was the compiler that compiles the mono C# compiler also written in C#?
20

The .NET framework was written in Simple Managed C (SMC)

History

During the development of the .NET Framework, the class libraries were originally written using a managed code compiler system called Simple Managed C (SMC).In January 1999, Anders Hejlsberg formed a team to build a new language at the time called Cool, which stood for "C-like Object Oriented Language".[16] Microsoft had considered keeping the name "Cool" as the final name of the language, but chose not to do so for trademark reasons. By the time the .NET project was publicly announced at the July 2000 Professional Developers Conference, the language had been renamed C#, and the class libraries and ASP.NET runtime had been ported to C#.

From: http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29

1 Comment

This answers a question, but not the OP's question.
10

There is a new (as of late 2011) C# and VB compiler written by Microsoft called Roslyn which is written in C# and VB.NET respectively. Project page is here. The Roslyn compiler is written as a library that exposes a rich public API. There is a news article here about it from InfoWorld.

UPDATE: As of April 3, 2014, Roslyn is open source under the Apache License 2.0.

Comments

9

Yes it was - as majority of CLR. If you want to see the internals of CLR and/or compilers I would strongly recommend Shared Source CLI from Microsoft (aka Rotor):

But, there is actually a compiler written in C#. I believe that Mono is written that way. Download Mono sources and find out for yourself.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.