Compiling my thoughts

I've been reading and thinking about compilers lately. There's something about code that writes other code that is just inherently fascinating. But a real compiler of any size still seems like far too daunting of a project.

I really like Autsin Henley's writeup of a toy compiler for a tiny BASIC-style language. Python is the language I am most comfortable with, and this was something I could follow along with and get working over the course of a day or two.

There's also Peter Norvig's article showing how to build a LISP interpreter. It is similar in scale, easy to follow, and also written in Python. But I'm really not a fan of lisp languages, so this was a little harder to get excited about.

On the more serious end of the spectrum, there is Build Your Own Lisp, but I was turned off by the reliance on outside tools like mpc to build the grammar for you. If I'm building a language from scratch, I want to build it from scratch. And of course, at the end of all that work, I'd just end up with a LISP and I don't see myself ever using that.

ALso on the serious side, I've worked through the first half of Crafting Interpeters. It's hard to get your head around a project that big, though. At a certain point, I felt like I was just copying code and not really retaining much information. I may still come back to this and see if I can't do better.

I guess the ideal project would be one that starts as a toy compiler that you could get up and running in an afternoon, but with room to grow and add features to eventually scale up into something actaully useful. I don't quite know what that is yet. It's hard to imagine anything within my abilities could also be useful or practical. It's also got me interested in trying to compile some toy language to LLVM IR, but trying to understand LLVM is completely overwhelming.