Comment by lihaoyi
5 years ago
While this example is pretty dense, a "one page programming language interpreter" doesn't need to be so impenetrable. Here's a one-page (67 line) interpreter for a subset of the Jsonnet programming language, implemented in Scala:
- https://github.com/handsonscala/handsonscala/blob/v1/example...
From the top down, that snippet contains an AST definition, a parser, an object model, an evaluator, and an output serializer. This 67-line programming language interpreter is one of the projects in my book https://www.handsonscala.com/ (chapter 20), and while this example is minimal the same techniques were used for my production-ready Sjsonnet interpreter
My favourite one page implementation of a programming language is 'a micro manual for lisp, not the whole truth' by John McCarthy.
https://www.uraimo.com/files/MicroManual-LISP.pdf