Nanopass Compilers

For the 2013 Clojure Conj, Andy Keep gave a great talk on nanopass compilers. The idea is that rather than having the normal 2, 3, or 4 passes in a compiler, you have several passes each of which does one small task. Each nanopass is basically a rewrite rule driven by a pattern matcher.

The talk is centered around a Scheme-to-C compiler that compiles a subset of Scheme to C. Keep put the compiler together over three days using a nanopass framework. The nice thing is that the compiler and the nanopass framework are available on Github for those who would like to experiment with it. The framework was developed for the compiler class at Indiana University and then used to rewrite the Chez Scheme compiler, a commercial compiler that compiles to machine code. This shows that the nanopass idea can definitely be used to build non-trivial compilers.

The talk is about 40 minutes so plan accordingly. If you like compilers or you’re interested in writing compilers in Lisp this is a video you will want to watch.

This entry was posted in Programming and tagged , . Bookmark the permalink.