Typescript implementation of a tree-walk interpreter for the Lox programming language.
What is lox? https://craftinginterpreters.com/the-lox-language.html
What is a tree-walk interpreter? https://craftinginterpreters.com/a-tree-walk-interpreter.html
Install dependencies using npm/yarn:
npm i
Then run the interpreter:
# Run in REPL mode.
npm start
# Or parse an entire file.
npm start samples/helloWorld.lox
If you want the interpreter to be available as a command-line app:
# Generate the source files.
npm install
npm run build
# Then link this repo.
npm link
# Then you can use the command.
tslox
tslox myFile.lox
This interpreter currently passes all of the dart tests present in craftinginterpreters repo. If you want to check for yourself, follow the steps below:
- Clone the munificent/craftinginterpreters repo.
- Install its dependencies (dart) and follow its instructions in order to run the tests.
- Once you can run tests, just use the command below:
dart tool/bin/test.dart jlox --interpreter tslox