Re:Contents • Build Your Own Lisp
by iainctduncan on Saturday April 29, 2023 @10:09AM
(#35753007)
I'm interested to know what is wrong with the approach in Crafting Interpreters, if you don't mind sharing.
[ Parent
| on HN ]
Re:Contents • Build Your Own Lisp
by grumpyprole on Saturday April 29, 2023 @11:16AM
(#35753709)
Not 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 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, bilding a more expressive and powerful language.
If one wants to learn specifically how Java works, then maybe a book on compilers would be better?
You 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)
Re:Contents • Build Your Own Lisp
by grumpyprole on Saturday April 29, 2023 @11:36AM
(#35753927)
Well 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.
Java in Java isn't slow, it is a matter of how it is done.
JikesRVM, MaximeVM and now GraalVM.
Re:Contents • Build Your Own Lisp
by grumpyprole on Sunday April 30, 2023 @03:42PM
(#35765939)
I agree but the context was interpreters. GraalVM is a compiler, it JIT compiles bytecode into machine code.