OCaml Interpreter
2022ProjectInternal / private
Tree-walking interpreter for a typed functional language, built from scratch for BU CS 320 (Programming Languages). Hand-written lexer, hand-written recursive-descent parser over the BNF grammar, and a stack-machine evaluator. No parser-generator — every token, every production, every reduction was written by hand. The exercise made the relationship between grammar, AST, and runtime semantics legible in a way that working with off-the-shelf parsers never quite does.
Highlights
- Hand-written lexer over the source grammar
- Hand-written recursive-descent parser over BNF — no parser-generator
- Stack-machine evaluator for the parsed AST
- Type checker for the typed core language
Run it
$ dune build$ dune exec interpreter <source.ml>$ dune runtestTech
OCamlCompilersInterpreters
README · github.com/ArkashJ/OCaml-Interpreter