This is the experiment repository for Implementation of Lox Language Using ASTro Interpreter Optimizer paper, which is submitted to PPL workshop 2026.
This repository is forked from ASTro repository, the Lox programming language is implemented as a sample of ASTro, which is in sample/lox. The project is managed by nix and devenv, checkout devenv.nix for dependencies.
To build the Lox on ASTro interpreter, first enter the sample/lox directory:
cd sample/loxTo build a interpreter compiled with Clang, run:
make clang_lox_releaseThen it will build a clang_lox_release executable in this directory, along with files generated by ASTro framework. Then you can run a Lox script by:
./clang_lox_release some_script.loxIt will run the script, as well as generate a node_specialized.c file, which is the specialized dispatchers of this script.
Then build clang_lox_release again, it will generate the specialized interpreter:
make clang_lox_releaseYou may encounter problem for building tree-sitter parser. Please refer to the Makefile:
# It works for nix-devenv managed system, if you use normal system, install tree-sitter first, and change the
# ../../../.devenv/state/cargo-install/bin/tree-sitter to the path of your tree-sitter executable.To get the result of Lox on ASTro compiled with Clang, run:
lua run_benchmarks-release.luaTo get the result of Lox on ASTro compiled with GCC, run:
lua run_benchmarks-release-gcc.luaTo get the result of Clox, first build the crafting interpreters:
cd craftinginterpreters
make get
make
cd ..Then run the following script to get the benchmark result of Clox:
lua ./test_bench.lua ./craftinginterpreters/clox ./loxcraft/res/benchmarks/