language-greenhouse
This is a small collection of interpreters/compilers focused on the technique of compilation by staging.
For more information, please see From definitional interpreters to native code through staging.
In general, each language module (see below) is self-contained -- featuring a language definition, an interpreter (which implements a small step semantics for the language), a parser for that language (I haven't defined the grammar, but refer to tests), and a JIT compiler using cranelift.
For each language module, take a look at the tests for example usage! In general, each test uses eval
and eval_staged
to denote the two evaluation paths (using the interpreter, or using the staged interpreter with code generation).
Languages
- Simple calculator language with an environment.
- Interpreter
- Compiler
- Functions as first class objects.
- Interpreter
- Compiler