- Lesson 1. The simplest arithmetic expressions (AE) evaluator
- Lesson 2. Parsing. Lexer of AE in math infix notation
- Lesson 3. Parsing. Parser of AE in math infix notation
- Lesson 4. Working with environments. Variables and built-in functions
- Lesson 5. Simple user-defined functions
- Lesson 6. Inner functions, lambdas and closures
- Lesson 7. Derived expressions (“Syntactic sugar”)
- Note 1. Stack-based evaluation of the simplest AE in the prefix notation
- Note 2. S-expression to AST transformer
- Note 3. Complex data structures: pairs and lists
Currently the first lesson is available where we describe the simplest interpreter of the arithmetic expressions (AE). Every lesson contains also exercises which are proposed to implement improving the understanding of the passed topic.
Besides the code sources from the repository (which are quite compact), the appropriate chapters of the series are planned.
At the end, we’re going to implement a (simple?) language with support of basic expressions, variables stored in environments and functions as closures (that is, quite easily implementing higher-order functions).
A previous work is the implementation of Scheme on Coffee language — an interpreter of Scheme written in CoffeeScript.
The inspiration of the series are two books on programming languages theory (PLT) and interpretation: SICP (Structure and Interpretation of Computer Programs) by Harold Abelson and Gerald Jay Sussman with Julie Sussman, and also PLAI (Programming Languages: Application and Interpretation) by Shriram Krishnamurthi. The books are recommended as additional literature.
Have fun with implementing programming languages
Dmitry Soshnikov, 2011-08-10.