6 ms·
I'm interested to know what is wrong with the approach in Crafting Interpreters, if you don't mind sharing.
by iainctduncan 3y ago
I'm interested to know what is wrong with the approach in Crafting Interpreters, if you don't mind sharing.
- grumpyprole 3y agoNot the parent and I've never read that particular book, but the premise seems rather bizarre to me, where is the excitement in implementing a slow version of Java in Java? If anyone is going to want to implement a custom interpreted language, it will likely be very different to Java, e.g. Lisp, the core of a DSL or configuration language. But it's still going to probably have functions and data types. Writing Lisp in C is exciting, one is moving up the abstraction hierarchy, building a more expressive and powerful language. If one wants to learn specifically how Java works, then maybe a book on compilers would be better?
- wiseowise 3y agoYou might not be excited about “implementing a slow version of Java in Java”, but that doesn’t make it a bad approach. (Also, second part is about implementing same interpreter in C)
- grumpyprole 3y agoWell implementing all the OOP semantics and such could complicate and dilute the essentials. A simpler language would also make it easier to cover more ground, such as type checking. So I don't think it sounds ideal from a pedagogical perspective either, but again, I haven't read the book. Note that Lisp in Lisp (SICP) works well because Lisp itself is very simple and just the essentials. It's just one chapter in SICP.
- pjmlp 3y agoJava in Java isn't slow, it is a matter of how it is done. JikesRVM, MaximeVM and now GraalVM.
- grumpyprole 3y agoI agree but the context was interpreters. GraalVM is a compiler, it JIT compiles bytecode into machine code.