[Mono-list] C++ to CIL compilers?

Miguel de Icaza miguel@ximian.com
20 Jan 2002 16:34:36 -0500


> Are there any C++ to CIL compilers _except_ Visual C++? 

Not at this point.  

> The idea of making component programming and reuse language independent
> is IMO the best thing about .NET/Mono. But I hardly found any compiler
> apart from MS's development suites targeting the CIL. As only a C#
> compiler is planed as part of the Mono Project and as the GCC Project
> does apparently not plan to add a CIL backend, do I have to invest a
> substantial sum of money (that I don't have) in a set MS compilers to
> start using Mono (using a language other than C#)?

The .NET Framework SDK (free download) contains a C++ compiler that you
can use.  It is called `cl.exe'.

As you know, we do lack the resources to build a C++ compiler (that is a
major task to take on).  My suggestion for anyone who is interested in
bringing a free C++ compiler to the .NET world is to take the gcc C++
compiler as a start, keep the "front-end" of the compiler (parsing and
semantic analysis) and write a CIL backend for it.  

Significant work needs to happen in the front-end as well to enable dual
managed/unmanaged compilation and recognize the .NET keywords (stuff
like __gc). 

I would start by splitting of the code to avoid making the job on
yourself harder.  Once a proof of concept compiler can be built, then
you can figure whether it is possible or worth to bring this back into
the main gcc code base. 

Other languages will appear at some point as writing front-ends for CIL
is relatively trivial given that it cleanly "separates" the phases of
the compiler.  So the work that you have to do is limited by the CIL
level.  

It took me only 8-months of part-time work on the compiler to write a C#
compiler, so it is something within the scope of a one semester class to
create other languages.

Miguel.