I'm thinking of learning about compilers and am pleased to find that there seems to be at least two very accessible choices, "Writing An Interpreter In Go" and Crafting Interpreters. Curious if folks here have experience with either and could provide recommendations?<p>https://interpreterbook.com/
https://craftinginterpreters.com/
Read both if you like.<p>I read and liked them both, but my heart belongs to Bob's writing, especially the C implementation in Crafting Interpreters and how he explains things.
Crafting Interpreters is the right at the top of my list of favorite programming books…and I’ve been reading them since the late 70’s. Amazingly clear and well-designed.
I recommend skimming over the first few chapters of crafting interpreters, the main value there is the recursive descent algorithm and abstract syntax trees, the rest is implementation. I've been developing my own language [1] and that's how I got started<p>The ideas in crafting interpreters are not language specific, the examples are in java, but I used C++ for instance. Im sure you could transfer the same ideas to Go. Then again I've never read the go book you are referring to<p>[1] <a href="https://youtu.be/azR1mUfFjHI?si=PsP-7o-w1yIN4xyq" rel="nofollow">https://youtu.be/azR1mUfFjHI?si=PsP-7o-w1yIN4xyq</a>
If you go with Crafting Interpreters, there is a coding challenge on CodeCrafters that follows the book: <a href="https://app.codecrafters.io/courses/interpreter/overview">https://app.codecrafters.io/courses/interpreter/overview</a><p>It is free (for now) and it helps me focused.
I'm doing Crafting Interpreters... in Go! The book uses Java, but I prefer Go so I just went with it. It was an interesting exercise to "translate" the understanding of the implementation shown in the book (which relies heavily in OOP) to something more idiomatic in Go.
I went over "Writing an Interpreter in Go" and "Writing a Compiler in Go" but instead of doing it in Go, I did it in C. In hindsight it was a very good decision, because it forced me to write the code myself, instead of mindlessly copying it. After finishing the books I've spent some time extending the compiler I've written and I've published it on github (<a href="https://github.com/kgabis/ape">https://github.com/kgabis/ape</a>). I've read Bob Nystrom's previous book, so I'm sure Crafting Interpreters is great as well, but I really recommend Writing an Interpreter/Compiler in Go.
Crafting Interpreters has been sitting on my shelf for two or so years. I would love to read the book but the use of Java shelved it. I don’t have the time to understand the concepts from the book while simultaneously learning Java.
I've read Writing an Interpreter in Go and Writing a Compiler in Go. Crafting Interpreters is on my bookshelf and on the list to get through Soon™. The latter books by Thorsten Ball are an incredibly approachable introduction to the topic. It's how I initially learned Go and it reinforced what I learned back in my undergrad on how parsers and compilers work.<p>I love writing parsers and get far too few opportunities to flex that muscle. I wish I had read Crafting Interpreters for this question, as well, but by all accounts it's an incredible tome, as well. Read them all and see what different information you pick up from them!
I only read Crafting Interpreters and I can recommend this one. It's also free as a website so you can evaluate it before making a purchase. I did think it is interesting enough to go straight to make the purchase.
There's also an excellent tutorial from LLVM, it got me started, I got some ideas and didn't want to be too influenced by "the right way", so I stopped somewhere mid tokenizer.. But I have a turing complete, interpreted language as of now, that I'm having a lot of fun thinking about.<p><a href="https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/index.html" rel="nofollow">https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/index...</a>
I started them but dropped them and went straight for:<p>- Engineering a Compiler<p>- Programming Language Pragmatics<p>- Crafting a Compiler<p>Quite doable, particularly if you focus on one and supplement with the other two.