May 23, 2016

Writing a compiler for a real language targeting a real processor architecture with meaningful optimizations is a very big job -- far too big to undertake just for fun or just to learn. Simplifying the problem is imperative.

I've done a bit of digging into various approaches and guides. There are a lot of them, because every respectable CS curriculum needs a compilers course.

The one I find most intriguing is by Niklaus Wirth, the guy behind Pascal and Modula-2. In his "Compiler Construction" PDF, he guides you through building a compiler as a series of exercises in a bit over a hundred pages. I get the impression you could work through the guide in 2-3 of weeks full time or perhaps a quarter as a side project.

http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf

Mar 13, 2016

Also take Niklaus Wirth PDF and follow how to write an Oberon-0 compiler end-to-end.

http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf

It is a very instructive process.