Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Does anyone know of any good books which describe the design and implementation of small VMs/interpreters like these?


I think it isn't a constrained enough topic to write a textbook on. The conclusion section of the article under discussion summarizes the technique pretty well.

I have encountered brief discussions of the technique in a few places though. Jon Bentley wrote a column called Programming Pearls, collected in a couple of compilation books, and one of those was called Squeezing Space which talked about this a bit. I think that Peter Norvig had a chapter on it in Paradigms of Artificial Intelligence Programming but couldn't swear to it. I've also read that KDB+ uses this technique, and I seem to remember that one of the few columns that discussed implementation (it's proprietary technology, so there's not much on it) talked about stuff like this.

The general idea was also briefly discussed in Dynamic Languages Wizards Series - Panel on Runtime (from 2001), though they didn't go into methods, just trade-offs [1]

[1] https://www.youtube.com/watch?v=4LG-RtcSYUQ


What's in PAIP is a bytecode compiler for Scheme with some discussion of simple optimizations, with a ref to a 70s or 80s paper by Deutsch (iirc) on design of a Lisp VM for a space-constrained computer.

Another paper that comes to mind is Anton Ertl's on his vmgen system. The Smalltalk-80 bytecode design is worth a look too.


Niklas Wirth has an example of a small RISC VM and interpreter in chapter 9 of his book on compiler construction.

https://people.inf.ethz.ch/wirth/CompilerConstruction/index....


The only one I know is this one here: https://craftinginterpreters.com/

It uses a simple stack machine. I am on the market for a book on small register based interpreters.


Niklas Wirth wrote a nice concise book on compiler construction. He’s targeting his own register-based RISC architecture.

https://people.inf.ethz.ch/wirth/CompilerConstruction/index....


I don't know of anything concrete, but looking for information about Pascal's p-code approach might be useful; given its historic significance and relative prominence, there's probably some decent information about it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: