Virtual machine implementation for the Lox programming language, implemented in ANSI C. Based on the language and design from Crafting Interpreters by Robert Nystrom.
There are a few build flags available
| Flag | Description | Default value |
|---|---|---|
ENABLE_DEBUG | Enables debug information: dissasembling op codes, printing runtime stack, logging garbage collector. | OFF |
ENABLE_NAN_TAGGING | Enables NaN tagging for value types. | ON |
You can use these flags in succession with cmake to generate the project. See an example script below:
cmake . -B out -DENABLE_DEBUG=OFFprint "Hello, world!";
var x = 10;
for (var i = 0; i < x; i = i + 1) {
print i;
}
Tip
You can find more lox code snippets under the test folder.