8df0ffb7e5d0bf170f3a372af3d4879d0d729c15
Implement a basic VM that is capable of simple math. Signed-off-by: Daniel Henry <iamdanhenry@gmail.com>
clox — Crafting Interpreters (clox, C)
A tiny bytecode VM + compiler for the Lox language, built while following Crafting Interpreters. This is a personal learning project.
Crafting Interpreters: https://craftinginterpreters.com/
Build
Requires a C99 compiler (tested with clang on macOS). Uses the provided Makefile.
# Build the executable to bin/clox
make
# Clean build artifacts
make clean
# Show discovered sources/objects (diagnostic)
make debug
# (Optional) regenerate compile_commands.json for clangd/etc.
make bear
Run (current behavior)
The current main builds a tiny test chunk and disassembles it—there’s no REPL or script runner yet.
./bin/clox
Example output:
== test chunk ==
0000 123 OP_CONSTANT 0 '1.2'
0002 | OP_RETURN
Layout
include/ # headers (.h files)
src/ # source (.c files)
obj/ # build objects (generated)
bin/ # executable output (generated)
Notes
- Tracks the book’s clox implementation; commits may follow chapters.
compile_commands.jsoncan be generated viamake bearfor editor tooling.
License
Private / for learning.
Description
Languages
C
93.4%
Makefile
6.6%