Writing a compiler in Ruby, bottom up

(To follow my compiler related posts, either subscribe to my main RSS feed, or the compiler specific one )

Back in March 2008 I started publishing a series on how to write a compiler in Ruby, bottom up, that is, starting with the code generator and working my way up instead of the more traditional approach of writing the parser first. Here are the parts I've published on my blog so far.

(The bits labeled "interlude" are sort-of related articles in that the cover issues with writing/developing compilers, or issues related to compilation, but are not directly tied into the actual article series)

All the code can now be found in this GitHub repository

Related resources

A recent (as of 2014) article series on "reconstructing" Ruby (in C)

Someone commenting on this series on Hackernews pointed to Nicklaus Wirth's excellent book on compiler construction (PDF available on his homepage) as a good starting point from a traditional, top down point of view. It's a good and very approachable book, and well worth a read.

Another great series with a more traditional approach is a famous series by Jack Crenshaw: Let's build a compiler

This page at Stackoverflow has a great list of other compiler writing resources.

blog comments powered by Disqus