Having the C# compiler as a service is an interesting new feature in Mono that was announced by Miguel de Icaza in his blog. Miguel leads the Mono project for Novell. This new feature supports the following scenarios:
- Run Mono's C# compiler on .NET
- Embed Mono's Evaluator in your C# app.
- Use Mono's REPL with the .NET framework runtime.
The compiler as a service is also being worked on by Microsoft. In this interview with Visual Studio Magazine,
Lisa Feigenbaum, Microsoft's community program manager for the Visual
Studio Managed Languages Team talks about the compiler as a service that Microsoft is working on.
MD: Is Microsoft still heading toward its vision of the "compiler as a service" for future versions of the C# compiler?
LF: Yes, very much so. "Compiler as a service" is a project in which we're re-writing the C# compiler in C#. In the process, we're opening up the compiler and exposing managed API's, so that you can query the compiler for information that was previously hidden behind a "black box." This change will enable several scenarios, including a richer language object model to support third-party extensions, the creation of a Read-Eval-Print-Loop, DSL embedding, and the ability to host C# in other contexts. We started on this project a couple of years ago, and plan to ship it in a future release, yet to be determined. It is a huge undertaking, and will take some time still to complete.
As she mentioned, Microsoft has been working on this for a few years. Here's a post from Lamda the Ultimate, where he found a video from 2008 where Anders Hejlsberg talked about this functionality.
Hopefully this will be a reality soon, but for now the Mono library is a good option.