For those interested in writing their own compiler in C#. There was a decent article a while back written by Microsoft employees with example code provided. Looks like MS have archived the post, but you can still browse the code (almost unadulterated) here: