Let me first say that this is an excellent book and IMO is as good as a Compiler book for laymen as it can be. It is way better than the other books with the same focus IMO (I compared it to two other books: "Game Scripting Mastery" and ""Writing Interpreters and Compilers for the Raspberry Pi using Python"). I really appreciate the efforts the author put into the book. This is one of the few CS books that I actually purchased a physical copy. However, I do have one recommendation:
Express Expr.java in code instead of generating it through a class GenerateAst.
I understand it might be more efficient to write a generator class than writing the whole Expr.java manually. But it is inconvenient for pedagogical reasons.
First, the Expr.java with the Visitor pattern, IMHO, is one of the most important ideas in the book, at least for the frontend. But I find it confusing to read the code through the generating class. Yes I later found out that there is a list of the whole Expr.java as an appendix, but maybe it's a bit easier if it is listed in the chapters.
Second, tabs are expressed as spaces in the code instead of "\t". I don't know about you guys, but I spent a ton of time trying to get the perfect indentation.
Third, everytime we read about new parameters, we have to go back to the Appendix to re-learn Expr.java (Oh this is how the code would look like after adding this new parameter). I think the reason is that the Visitor pattern is not particularly intuitive for me. This could be me stupid but I think it could happen to other laymen as well.
What do you think? Do you agree with me?