I was cleaning out my old papers (finally!) and came across an old paper I had titled “Compiler Writing Tools using C#” which essentially shows how you can write a number of tools like lex and yacc but instead of C/C++ on Unix, you use C# and .NET.
This paper covers the tokenizer, grammar, DFA, NFA, etc. I think conflicts and precedence is one area it would need a little more work. But overall its a very interesting piece of work – especially for one to learn the ropes if a lot of this is new.
Of course, writing compilers with C, overall is not the most productive experience (it sure is fun though!); if you have never done it before Standard ML or Haskell would be a better place to start. If you want to stick to .NET and roll out your own language (or create extensions) then check out this paper on MSDN.
All of this brought back memories when I wrote my own C++ compilers mainly with those tools on Unix System V and also on Xenix. Most people did not know (or perhaps remember) that Microsoft had a Unix version called Xenix which was later bought over by SCO and eventually become part of SCO Unix. Back in the days I use to run a dual-boot machine with Xenix and DOS. 🙂