3 ms·
My apologies, that does indeed seem like a reasonable way of doing it.
by grumpyprole 2y ago
My apologies, that does indeed seem like a reasonable way of doing it.
- munificent 2y agoAlso, I should note that even in the first half of the book, the language isn't Java-like. It has Java-ish syntax, but the semantics are much closer to JavaScript/Python/Lua. In the first half, what we gain from implementing it in Java is mostly the garbage collector. The rest of the static and runtime semantics basically have to be implemented from scratch on top of the JVM.
- grumpyprole 2y agoThere is significance coverage of OOP features, hence my Java-like comment. I would have personally left OOP out for a beginner book, it isn't really fundamental. Another advantage to using Java in the first half, could be to use Java closures to implement Lox closures.
- munificent 2y ago> I would have personally left OOP out for a beginner book, it isn't really fundamental. This was a deliberate choice. Most intro compiler/interpreter books don't do OOP. But most languages in wide use today are object oriented. That felt like a significant gap to me. One of the main goals with my book is to give people insight on how the languages they actually use work under the hood. Skipping objects and method dispatch would limit that.