Einar Egilsson

While Compiler for the .NET Platform

Posted: Last updated:

My masters project at DTU involves writing compilers for the .NET platform and since I had never written a compiler before I decided to start by writing a compiler for a simple language called While. This language is used in the Program Analysis course that is taught at DTU and has integer and boolean expressions, read and write commands, an if branching statement and a while looping statement. The compiler compiles this language and the programs can be run with the .NET CLR or Mono. The programs can also be debugged using a free graphical .NET debugger.

I put the project up on Github, I think it is a fairly nice example of a simple compiler for .NET.The compiler and its source code along with a better description of the language is available at https://github.com/einaregilsson/While-Language.

If you read this far you should probably follow me on Twitter or check out my other blog posts.