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.
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;"
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.
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: https://dabeaz.com/.
Quick tips for folks about to take the course
If you're about to take the course, here are some quick tips for you:
- Definitely use a program language you are comfortable in. I do not recommend using this as an opportunity learn a new language. Make no mistake: you will write a lot of code and you don't want other details to distract you from the material at hand.
- In a similar vein, this isn't a good time to mess with your editor/environment. You might be tempted to try out a new editor or something. I don't recommend doing that either. It's distracting.
- Poke around everyone's branches. It is super interesting to see how other folks approach the same problem. You might learn something new.
- Get good sleep, eat well, etc. I guess this should apply to... every day life. But the pace of David's course is intense and my brain was fried every day. I couldn't have kept pace if I wasn't feeling good.
- Have fun! His class will challenge and confuse you. You will make a lot of mistakes and introduce a lot of bugs. Your code will probably be a mess. Don't worry about it, roll with it, and enjoy the process! It's fun to hack on something new.
Questions? Comments? Feedback? Please send me a note!