A complete interpreter for a small dynamically-typed language, written in Rust. Follows the structure of Crafting Interpreters (Nystrom) — scanner, parser, AST, tree-walking evaluator — but diverges in a few places where Rust’s ownership model pushes toward different designs.

Features

  • First-class functions and closures
  • Lexical scoping with an environment chain
  • Integers, floats, booleans, strings, nil
  • if/else, while, for control flow
  • Error reporting with line numbers

Notes

This helped me understand scanners, parsers, environments, and closures in a more practical way. Rust’s ownership rules also forced a few design decisions that would have been easy to ignore in a looser language.

Shipped in November 2024. Not maintained - it is a learning project, not a tool.