← Back to context

Comment by CodeArtisan

5 years ago

A virtual machine executes instructions while an interpreter takes source code as input. An interpreter could be built on top of a virtual machine, obviously, but not necessary. For example, SICP/PLAI/OOPLAI[1] explain how to implement an interpreter on top of Scheme where you directly interpret the s-expressions. These may be a worth read if you want to learn about the usual concepts and techniques used in programming language implementations from a more general point of view. Like, for example, how to implement a static type system or an object model based on classes. Interpreters based on a virtual machine are actually compilers on the fly; the source code is not interpreted but translated into instructions beforehand.

[1] http://sarabander.github.io/sicp/

http://cs.brown.edu/~sk/Publications/Books/ProgLangs/2007-04...

https://users.dcc.uchile.cl/~etanter/ooplai/