https://github.com/dannymcgee/lox
https://github.com/dannymcgee/lox
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dannymcgee/lox
- Owner: dannymcgee
- License: other
- Created: 2020-12-23T07:03:54.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-05-12T19:18:17.000Z (12 months ago)
- Last Synced: 2025-03-06T06:51:51.583Z (2 months ago)
- Language: Rust
- Size: 577 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lox
Yet another Lox implementation (from the excellent book [Crafting Interpreters](https://craftinginterpreters.com/))
## Implementations
- Tree-Walk interpreter in TypeScript (because it's my comfort zone) – **Complete**
- Bytecode VM in Rust (started almost a year ago in a naive attempt to learn the language from scratch — ha! Revisiting now that I'm a battle-hardened Rustacean) **~25% done**## Misc
- Simple but accurate VS Code grammar for syntax highlighting available under `packages/vscode-lox`
## Running the Project
### Dependencies
The workspace is managed through [Nx](https://nx.dev/). Globally install the `nx` Node package for the best experience:
```sh
yarn global add nx
# or
npm i -g nx
```Then install dependencies:
```sh
yarn
# or
npm i
```### TypeScript AST-Walker
#### Start the REPL
```sh
# nx start ts
# Just kidding, this is broken
```#### Run one of the example files
```sh
nx start ts --example # e.g., nx start ts --example fizzbuzz2
```#### Generate AST types
Modify the definitions in `packages/tools/src/lib/generate-ast.ts` as necessary, then run:
```sh
nx run tools:generate
```### Rust VM
#### Start the REPL
```sh
# Only partially implemented so far
nx start vm # --debug parse,codegen,exec
```#### Run one of the example files
```sh
# Not yet implemented
nx start vm --example # e.g., nx start vm --example fizzbuzz2
```## Build the VS Code grammar
```sh
yarn run package:vscode-lox
```The VSIX installer will be under `dist/packages/vscode-lox/`