3 ms·
Both Crafting Interpreters and MAL are bad tutorials for non-toy Lisps and use dubious implementation decisions (just not as many as "build your own lisp"). Go
by armitron 3y ago
Both Crafting Interpreters and MAL are bad tutorials for non-toy Lisps and use dubious implementation decisions (just not as many as "build your own lisp").
Good references for building a Lisp are "Lisp in small pieces" and Nils Holm's "LISP from nothing".
- iainctduncan 3y agoI'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.
- jmkr 3y agoInteresting, I started going through Lisp In Small Pieces a while ago, and I enjoyed the first chapter, but put it on the shelf for a while. I've been meaning to pick it back up, but was considering going through Crafting Interpreters first (and started reading it but since I don't know Java I spent more time trying to figure out a good setup with Java and Emacs). How is Nils Holm's "LISP from nothing?" I discovered it a while ago, but probably judged it by its cover (and the typesetting). Any other recs in the PL/compilers world would be appreciated. I'm probably the only person that did not like EOPL. I bought the 3rd edition, went back to the 2nd edition, and at some point early on the eval did not work. Which is a shame since I enjoyed Friedman's Little/Seasoned Schemer and Scheme and the Art of Programming