Skip to content

C++ Implementations of programming languages and type systems studied in "Types and Programming Languages" by Benjamin C. Pierce..

License

Notifications You must be signed in to change notification settings

ergawy/types-and-programming-languages

Repository files navigation

Types and Programming Languages

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.

Directory Structure

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.

Status

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

Usage

Running Tests

cd ch##_<lang>
clang++ --std=c++17 test.cpp && ./a.out

Interpreter

cd ch##_<lang>
clang++ --std=c++17 interpreter.cpp && ./a.out "input program"

About

C++ Implementations of programming languages and type systems studied in "Types and Programming Languages" by Benjamin C. Pierce..

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published