Live data from Hacker News

Microsoft Open Sources C# Compiler

roslyn.codeplex.com

91–100 of 459 posts

Re: Microsoft Open Sources C# Compiler

#91
post #81

Earlier quoted context omitted.

The C# compiler is written in C#, so you can use it anywhere with a .NET runtime. Microsoft doesn't ship a .NET runtime for Linux, so you'll have to use Mono, but if your app is compatible with Mono, you're good to go!

How does something like this happen? How can you write a compiler in the language that it is supposed to be compiling?

Most compilers I know of start with an implementation in another language and eventually write a self-hosted one. Microsoft already had compilers for .NET, though, so you just compile it with those until it's self-hosting.

Bootstrapping a compiler from nothing is harder and involves a lot of incremental steps. http://en.wikipedia.org/wiki/Bootstrapping_(compilers)

Re: Microsoft Open Sources C# Compiler

#92
post #81

Earlier quoted context omitted.

The C# compiler is written in C#, so you can use it anywhere with a .NET runtime. Microsoft doesn't ship a .NET runtime for Linux, so you'll have to use Mono, but if your app is compatible with Mono, you're good to go!

How does something like this happen? How can you write a compiler in the language that it is supposed to be compiling?

This is almost second-nature in Lisp:

http://c2.com/cgi/wiki?StructureAndInterpretationOfComputerP...

And tends to happen to other languages... you just have to bootstrap the first compiler.

Re: Microsoft Open Sources C# Compiler

#93
post #81

Earlier quoted context omitted.

The C# compiler is written in C#, so you can use it anywhere with a .NET runtime. Microsoft doesn't ship a .NET runtime for Linux, so you'll have to use Mono, but if your app is compatible with Mono, you're good to go!

How does something like this happen? How can you write a compiler in the language that it is supposed to be compiling?

http://en.wikipedia.org/wiki/Bootstrapping_(compilers)

Re: Microsoft Open Sources C# Compiler

#94
post #87
post #81

Earlier quoted context omitted.

How does something like this happen? How can you write a compiler in the language that it is supposed to be compiling?

They wrote the original C# compiler in a different language (probably C++) first. Then they wrote the second C# compiler in C#, and used the first compiler to compile the second compiler. Voila!

We regularly dogfood, so we're on like N iterations of your structure, but that's the idea!

Re: Microsoft Open Sources C# Compiler

#95
What kind of patents do they have on the compiler tech, and is there any guarantee they won't go after you for using it?

edit: Ah nice, Apache 2 license explicitly calls out a patent license is granted for use. I wonder how much cajoling it took to get the lawyers to agree to that!

Re: Microsoft Open Sources C# Compiler

#96
post #75

Earlier quoted context omitted.

The C# compiler is written in C#, so you can use it anywhere with a .NET runtime. Microsoft doesn't ship a .NET runtime for Linux, so you'll have to use Mono, but if your app is compatible with Mono, you're good to go!

Is Mono able to compile Roslyn?

It should. Here's the Roslyn source, and it looks to be all in C# and VB: http://roslyn.codeplex.com/

Re: Microsoft Open Sources C# Compiler

#97
post #58

Step in the right direction. I'm still waiting for git clone https://github.com/microsoft/windows.git to happen

How much of a hipster are you?

I'm a hipster because I like open source and want more not-open-source things to be open source?

Re: Microsoft Open Sources C# Compiler

#98
post #81

Earlier quoted context omitted.

The C# compiler is written in C#, so you can use it anywhere with a .NET runtime. Microsoft doesn't ship a .NET runtime for Linux, so you'll have to use Mono, but if your app is compatible with Mono, you're good to go!

How does something like this happen? How can you write a compiler in the language that it is supposed to be compiling?

First you solve the chicken and egg problem by writing a bootstrap compiler for the language in some other language (e.g. a C# compiler in C or C++, or a C compiler in assembly language). Then you can compile programs in the new language, and compilers are programs, so you can write a C# compiler in C# and the binary so produced will be able to compile its own source.

Re: Microsoft Open Sources C# Compiler

#99
post #79

Earlier quoted context omitted.

What's the likelihood the .NET VM is open sourced as well? I use Mono right now to run my apps on Linux but it would be great to use the official implementation since Mono has subtle differences.

That's the main thing I would be interested in also, but I'm thinking that's one thing that we WILL NOT see. That could seriously undercut the need to buy Windows servers.

There's a trade off though. If C# only runs on Windows then a lot of developers who run Linux will never consider C# as an option. If it does run on Linux, then those developers might end up purchasing Visual Studio in order to develop C#. A lot of developers who previously used C# are also leaving the tech for others like Ruby since they aren't tied to Windows.
Post reply on HN