Implement basic parsing / scanner Signed-off-by: Daniel Henry <iamdanhenry@gmail.com>
46 lines
789 B
Markdown
46 lines
789 B
Markdown
# 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
|
|
```
|
|
|
|
## Usage
|
|
|
|
Run a file
|
|
```sh
|
|
clox [file]
|
|
```
|
|
|
|
Run Repl
|
|
```sh
|
|
clox
|
|
```
|
|
|
|
## Layout
|
|
|
|
```
|
|
include/ # headers (.h files)
|
|
src/ # source (.c files)
|
|
obj/ # build objects (generated)
|
|
bin/ # executable output (generated)
|
|
```
|
|
|