I wrote "Crafting Interpreters" and read and very much enjoyed Thorsten's interpreters book. (I haven't gotten to his second one yet.)
They are surprisingly alike. Mine takes you through two complete implementations of the same language: first as a tree-walk interpreter and then as a bytecode compiler. His first book does the former and his second book does the latter.
Both are written in an informal friendly style and focus on working code. If you like one, you'll probably like the latter.
Mine uses Java for the first language and C for the second. Thorsten's books use Go for both. I think mine has more background information, theory, and historical context. His will get you to a working interpreter with less prose to wade through.
I think it's mostly a question of style and preference. I'd dip into the first chapter of each and see which resonates with you.
These things pop up like whack-a-mole. I went ahead and reported them.
In general, customers seem to be pretty good at distinguishing garbage on Amazon from the real deal, and my actual listing has enough reviews that it clearly stannds out as the one they want.
Personally I often go to Amazon to find things, google the author and check on the HP on how to buy the book with the least amount of "tax" for the author.
Added benefit: you get formats outside of walled gardens!
Nice review of Thorstens book. I read your book when I graduated college around 2018 and was unfulfilled at work. It was a lot of fun and I distinctly remember sitting in a coffee shop for hours reading through it and debugging my code.
Unsurprisingly my family asked what I wanted for Christmas and I put both your book and Thorstens on my list to reread .
It was a hard choice. I wanted a language that was:
1. Fairly high level with garbage colleciton so users didn't have to worry about pointers and stuff while they were trying to learn basic concepts.
2. Object-oriented, since that's familiar territory for many programmers and because I wanted to show some techniques around working with programming languages in an object-oriented language, like the visitor pattern.
3. Widely known and not mostly confined to a single platform or domain.
4. Statically typed, since I think it makes it much easier to see what types are flowing through the code when it's on paper and you don't have a debugger to help you.
There isn't much in the intersection of that set. Functional languages like SML and Haskell are great for writing compilers and interpreters, but now readers have to learn two things at the same time. C++ is a reasonable widely known typed OOP language, but is a nightmare of complexity. JavaScript is a good OOP linqua franca but the lack of types is a drag. TypeScript is maybe a good choice, but it's type system is so complex and JavaScript has so much weird baggage that I didn't want to go there. C#, Swift, and Kotlin are all nice languages but hew mostly to specific platforms.
Java was the least bad lingua franca I could find. I also don't mind it as a language.
> It’s just that Java is so longform.
My experience is that Java isn't particularly verbose as long as you don't program in a 90's Enterprise Java style.
> as the low-level code is simpler and smaller.
The C bytecode VM is quite compact, but it is so because it deliberately discards a bunch of things like an AST, simple environment representation, or separate resolution pass. It is designed to be implemented in C.
But I also want to teach users those other concepts. If I'd written the tree-walk interpreter that you do first also in C, it would end up a huge sprawling C program. Just dealing with allocating and freeing the AST nodes at the right time would have been miserable.
Not to mention, it means you would have to implement a garbage collector very early on since Lox relies on it but C doesn't have it.
I've bought and read both, but the one I used for my interpreter was Interpreter Book by Thorsten Ball, because it's written in Go and Go is currently my favorite language. They both work well, though!
They are surprisingly alike. Mine takes you through two complete implementations of the same language: first as a tree-walk interpreter and then as a bytecode compiler. His first book does the former and his second book does the latter.
Both are written in an informal friendly style and focus on working code. If you like one, you'll probably like the latter.
Mine uses Java for the first language and C for the second. Thorsten's books use Go for both. I think mine has more background information, theory, and historical context. His will get you to a working interpreter with less prose to wade through.
I think it's mostly a question of style and preference. I'd dip into the first chapter of each and see which resonates with you.