I'll be honest. I put myself off from doing this for far too long because I found it so daunting. Generally, I like exploring and learning stuff that fascinates me, but Compilers always went over my head. Because I'm now in my 'you-miss-all-the-shots-you-don't-take' phase, here I am. This project/endeavour is for me to be able to turn what's been an obstacle into a milestone.
After searching endlessly (2 days, hehe) for a good place to start, I happened to come across this wonderful book by Robert Nystrom: Crafting Interpreters. After all the bulky and textbooky? resources I found, this one seemed refreshing. It didn't ask much of you except for knowledge of Java and C, and some good 'ol commitment. What I also liked was the way it was written - slightly goofily (with doodles and metaphors - a figure of speech I use way too much!), but above all, incredibly accessibly.
An interpreter shares the same front-end as a Compiler (performing scanning/lexical analysis, parsing, forming the syntax tree, and semantic analysis) and is hence a great way to start learning Compilers. So here I go!
Over the next few days, I’ll share updates on building the jlox interpreter for Robert’s language Lox, in Java, following chapters 4-13. I'll include the things I understood, things I didn't, and also some musings - which may or may not relate to Compilers at all. I don't know, I love writing and I'll take any excuse to do it!
I also like the idea of Compilers because on a very philosophical level, they're all about balance and harmony. They sit at the intersection of the human (high level language) and computer (machine level language) worlds, enabling the latter to understand us. Balance is a value that resonates very deeply with me, and is something I strive to find and apply in life too.
So come aboard! I hope that at the end of this voyage, we’ll have a gleaming interpreter that uncovers the hidden treasures of code and charts them into understanding.
Top comments (0)