Implementations of programming languages and type systems studied in Types and Programming Languages.
Each subdirectory implements one of the languages studied in the book. Each such implementation consists of a lexer, parser, interpreter, and type system for the language implemented.
Each implementation contains 3 files:
- interpreter.hpp: This is the main part containing the actual implementation of the language.
- interpreter.cpp: This file contains a simple main() method to invoke the interpreter. For now, it only accepts a single command line argument consisting of the program to be evaluated.
- test.cpp: Contains tests for the separate components of an interpreter: lexer, parser, and interpreter.
Language | Directory | Status |
---|---|---|
Untyped Arithmetic Expressions | ch04_arith | ✔️ Lexer + Tests ✔️ Parser + Tests ✔️ Interpreter + Tests |
The Untyped Lmabda Calculus | ch07_untyped | ✔️ Lexer + Tests ✔️ Parser + Tests ✔️ Interpreter + Tests |
Typed Arithmetic Expressions | ch08_tyarith | ✔️ Lexer + Tests ✔️ Parser + Tests ✔️ Interpreter & Type Checker + Tests |
Simply Typed Lambda Calculus | ch10_simplebool | ✔️ Lexer + Tests ✔️ Parser + Tests ✔️ Type Checker + Tests ✔️ Interpreter + Tests |
Typed Lambda Calculus (with various extensions) | ch11_fullsimple | Natural numbers (Nat) type support ✔️ Lexer + Tests ✔️ Parser + Tests ✔️ Type Checker + Tests Records and Projections ✔️ Lexer + Tests ✔️ Parser + Tests ✔️ Type Checker + Tests |
Typed Lambda Calculus with Subtyping | ch17_rcdjoinsub | ✔️ Lexer + Tests ✔️ Parser + Tests ✔️ Interpreter + Tests |
Typed Lambda Calculus with Imperative Objects | ch18_fullref Example Programs |
Let bindings support ✔️ Lexer + Tests ✔️ Parser + Tests ✔️ Interpreter + Tests References (Ref, Source, Sink) ✔️ Lexer + Tests ✔️ Parser + Tests ✔️ Interpreter + Tests Sequencing ✔️ Lexer + Tests ✔️ Parser + Tests ✔️ Interpreter + Tests Recursion ✔️ Lexer + Tests ✔️ Parser + Tests ✔️ Interpreter + Tests |
cd ch##_<lang>
clang++ --std=c++17 test.cpp && ./a.out
cd ch##_<lang>
clang++ --std=c++17 interpreter.cpp && ./a.out "input program"