LOX
A bytecode compiler and stack-based VM for Lox, the language from Robert Nystrom's Crafting Interpreters, extended with arbitrary-precision numbers, bytes, maps, and a standard library of native modules.

Project Details
Client
Bismit Panda (Me)
Year
2024
Role
Developer
Status
Shipped
Ownership
Independent project
Technologies
The Challenge
Turning the clox design from Crafting Interpreters into a language with a usable standard library, in C, where memory is managed by hand and a bad pointer is a security bug.
The Solution
Hand-written scanner, single-pass compiler, and a stack-based VM with a mark-and-sweep garbage collector and a readline REPL with tab completion. The standard library is written in C on top of existing libraries: PCRE2 for regex, SQLite and LevelDB for storage, OpenSSL for hash digests, zlib, LZ4, Zstandard, and Snappy for compression, libarchive for archives, and JSON, TOML, and YAML parsing. Integers are GMP bignums and floats are MPFR values.