I am just in the beginning of my graduation project that is supposed to last for 6 months. The goal of the project is to implement a .Net-compiler for one scripting language. I had the Compiler Construction as a subject in my curriculum and am aware of the basic steps how to implement a compiler in general, but we used Bison and simple compiler with GCC as back-end and thus I don't know much about implementing compilers on .Net platform.
Having carried out some research on this topic I found the following alternative solutions for code generation (I am not talking about other essential parts of compiler, like a parser -- it is out of scope here):
- Direct code generation using Reflection.Emit.
- Using Common Compiler Interface abstraction over Reflection.Emit for automation of some code generation.
- Using CodeDOM for C# and VB compilation at runtime.
- There is a new emerging C# "compiler as a service" called Roslyn, available as a CTP now.
- DLR offers support for dynamic code generation and has some interfaces for runtime code generation via expression trees etc.
- Mono is shipped with Mono.Cecil library that seems to have some functionality for code generation as well.
The primary goal of my project is to delve deeper into the guts of .Net, to learn Compiler Construction and to get good grade for my work. The secondary goal is to come up with a compiler implementation that can be later opened to the community under a permissive open-source license.
So, what would be a most interesting, educative, entertaining and promising approach here? I would have definitely tried all of them if I had some more time, but I need to submit my work in 6 months sharp to get a positive grade...
Thank you in advance, Alexander.