By the end of this book you should have a thorough understanding of the inner workings of a programming language interpreter. The source code is presented in full, and several iterations add more features until it could be considered pretty complete. The interpreter is written to be as easy to understand as possible; it has no clever optimizations that might obscure the basic ideas, and the code and the ideas will be described to the best of my ability without any unexplained technical jargon. It is however assumed that you have a good working knowledge of Perl (Perl5), including its object-oriented features.
The final implementation will demonstrate:
- primitive arithmetic operations;
- conditional evaluation;
- local variables;
- functions and closure;
- recursion;
- list processing;
quote
—preventing evaluation;- a simple macro facility;
- variable assignment and side-effects;
- procedures (as opposed to functions) and sequences;
- objects and classes;
- continuations;
- threads;
- exceptions;
- non-determinism and chronological backtracking;
- logic programming.