Compilers with David Beazley: a recursive descent into madness (and delight)

Headshot of
                Vikram Oberoi

Vikram Oberoi


November 19, 2022

· 5 min read

Compilers with David Beazley: a recursive descent into madness (and delight)

A cat typing on a laptop taking a compilers course.
A cat taking a compilers course. Credit:

I got carried away with that title, sorry.

I wrapped up David Beazley’s week-long compilers course yesterday and it was a total hoot. If you’ve been considering taking this course, I want to share my (lovely) experience and what you can expect from it.

David’s compilers class is an intense, hands-on primer to implementing a programming language. Over five days, we built an interpreter and compiler for a toy language called Wabbit from scratch. David designed the language and the spec is small enough to get something cool working while having gobs to wrap up and explore if you choose to.

The Mandelbrot set printed out on a terminal window.
It was thrilling to be able to compile and run Wabbit code that prints out the Mandelbrot set!

David’s done an outstanding job designing the project for this class. It was challenging but I learned a ton and always had something to show for my effort. Every day we’d have working code for some practical aspect of Wabbit that also set us up the next day. It was a great way to build momentum.

For example, on day one I built a syntax tree model and a code formatter that could take a tree I constructed and generate valid, nicely-formatted Wabbit code. This might look something like this:

# The following returns "print 4 + 5;"
            Add(IntegerLiteral("4"), IntegerLiteral("5"))

The example above is trivial but the model I built on the first day covered the entire language spec. It gave me a solid foundation to build a parser the next day. I also had a practical tool for Wabbit and got to appreciate how code formatters I use every day are built. Python Black’s line generation code is not far from what we implemented on day one.

I think that is an awesome result to have so quickly, and it’s what you can expect daily.

I won’t go into more detail here because David experiments with his course and spends a ton of time on its design and his materials.

A printout of error messages on a terminal screen.
Emitting useful error messages was easily the most difficult part of the course for me. It is really tough to do this well and where I made the least progress.

If you’re going to take the course, note that it is a ~40 hour commitment. There are about 3 hours of discussion daily with the rest of the time dedicated to hands-on implementation. There’s a Gitter chat where David and all the students can ask questions and share code and confusion. Everyone’s working on their implementation in the open, David included, so you can pop into different branches and see approaches folks are taking.

The course is light on theory. I took a compilers course in college about 15 years ago and I think we spent ~2-3 weeks investigating different parsing techniques and talking about automata and grammars. David does not do that.

Yet I have a solid foundation for further study after this week. I know how topics like parsing, type checking, semantic analysis, garbage collection, and code optimization fit in the language implementation landscape. I understand the contours of those topics, what to search for, and how I might go about navigating code to explore them in open source projects. I think I know where I would need to begin with any of those in my Wabbit implementation.

One neat thing I want to note is that we talked about error message generation more than I expected. David’s keen on figuring out how to do this well. He mentioned that compiler books all punt on the topic of error messages, but he doesn’t because they’re core to making a programming language usable.

Importantly, it’s representative of where his course falls on the spectrum between theory and practice.

David’s a great teacher. If you haven’t seen any of his talks on YouTube yet, seek them out. His compilers course is a fantastic way to survey the field as a practitioner. You’ll write a lot of code and build an interpreter and a compiler in five days. The work will challenge you but you’ll learn a lot and be rewarded with some exciting results.

If that sounds like your cup of tea, take the course. Sign up for compilers, or another one of David’s courses, here:

Quick tips for folks about to take the course

If you’re about to take the course, here are some quick tips for you: