A dynamically typed, interpreted language compiled and executed on its own virtual machine. (Garbage Collected)
  • Rust 98.2%
  • Shell 1.8%
Find a file
Abdulrazaq Alhendi ac6ed64def perf(vm): replace binary operands with a single stack update
Replace pop/pop/push in equality and numeric binary operations with a helper that writes the result and updates the stack pointer once. Document how the explicit update avoids redundant stores and a reload caused by conservative raw-pointer alias analysis.

Validated release conformance with and without NaN boxing. Pinned local benchmarks measured 8.7% less time for equality and 5.8% less time for Fibonacci.
2026-09-14 10:12:35 +03:00
examples/benchmark test: add dependency-free Rust runner for upstream clox conformance tests 2026-09-13 12:07:46 +03:00
src perf(vm): replace binary operands with a single stack update 2026-09-14 10:12:35 +03:00
tests test: add dependency-free Rust runner for upstream clox conformance tests 2026-09-13 12:07:46 +03:00
.gitignore init: loxest base 2024-05-05 11:55:58 +03:00
benchmark.sh perf: reduce struct memory footprint by migrating from usize to i32 2025-09-14 19:03:23 +03:00
Cargo.lock init: loxest base 2024-05-05 11:55:58 +03:00
Cargo.toml chore: update Cargo.toml for Rust 2024 edition 2025-09-09 20:21:33 +03:00
grammar.ebnf docs: add README and example benchmark programs 2024-07-01 22:30:02 +03:00
README.md test: add dependency-free Rust runner for upstream clox conformance tests 2026-09-13 12:07:46 +03:00
rust-toolchain.toml refactor: move parser to own file. clean up imports 2024-07-23 23:10:53 +03:00
THIRD_PARTY_LICENSES.md test: add dependency-free Rust runner for upstream clox conformance tests 2026-09-13 12:07:46 +03:00
TODO.md refactor: switch to local compiler 2024-07-24 16:44:37 +03:00

Loxiest

What is Loxiest

A dynamically typed, interpreted language compiled and executed on its own virtual machine.

It aims to compatible with Bob Nystrom's Lox implementation in C.

This implementation uses a mark-and-sweep garbage collector. It also supports nan-boxing as an optional feature. While this has resulted in noticeable improvements on x64 architectures, it may less effective or might even be slower to use on ARM64 architectures such as Apple Silicon.

Installation

Stable binaries are available on the releases page.

Usage

Running the REPL

./loxiest

Running a file

./loxiest <filename>.lox

Features

Loxiest comes with a disassembler and a trace execution printing. To enable these features, follow the development guide and enable the features within the Cargo.toml file or on the command line for a single run.

Cargo.toml

edit the default features line:

[features]
default = ["debug-trace-execution", "debug-print-code", "nan-boxing"]

CLI

To run a single feature:

cargo run --release --features "debug-print-code" # or whatever feature

To run all features:

cargo run --release --all-features

Development

To download and develop on Loxiest, clone the repository and build using Cargo. Cargo, as well as Rust can be installed via rustup.

Once downloaded, navigate to the project root directory and run:

cargo build --release

Testing

Run the upstream Lox black-box compatibility suite via the Rust runner.

cargo test --release

# Run a subset and show each fixture's result.
LOX_TEST_FILTER=closure/ cargo test --release --test conformance upstream_clox -- --nocapture

# Test another interpreter executable.
LOX_TEST_INTERPRETER=/absolute/path/to/clox cargo test --test conformance upstream_clox -- --nocapture

Filters are path prefixes relative to tests/upstream/. LOX_TEST_DIR overrides that directory.

Documentation

TODO. Someday. Maybe. Or read the code.

Notes

The benchmark examples are copied from the craftinginterpreters repository and are under the MIT License.

Lox test files in tests/upstream/ are copied unchanged from craftinginterpreters. The Rust test runner ports the final clox suite replacing the Dart runner. These tests and the original runner are by Robert Nystrom and covered by the MIT license.

The copyright and license notice for the benchmarks, tests, and ported runner is in THIRD_PARTY_LICENSES.md.

License

MIT License - Copyright (c) 2024 Abdulrazzaq Alhendi.