Files
clox/README.md
2025-08-21 16:33:47 -05:00

59 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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.
```sh
# 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—theres no REPL or script runner yet.
```sh
./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 books **clox** implementation; commits may follow chapters.
- `compile_commands.json` can be generated via `make bear` for editor tooling.
## License
Private / for learning.