You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Jamie Quigley b5e2f8911d
Merge pull request #5 from Sciencentistguy/renovate/better-panic-0.x
7 days ago
clox-pp Add nix build scripts for cpplox and clox_pp 3 months ago
cpplox Add nix build scripts for cpplox and clox_pp 3 months ago
hslox Add nix shell file 3 months ago
rclox Update Rust crate better-panic to 0.3.0 1 week ago
.gitignore Calls and Functions 5 months ago
LICENCE Relicence to MPL 2.0 5 months ago Relicence to MPL 2.0 5 months ago
renovate.json Add renovate.json 2 months ago

Crafting Interpreters

This repo contains multiple (incomplete) implementations of a Lox interpreter. Lox is a language designed by Bob Nystrom for his book Crafting Interpreters.


cpplox is a tree-walk interpreter for Lox, written in C++. This is the only of the four that is complete.

It has very bad performance, due not only to the design, but also to the fact that it uses far too many std::shared_ptr and other inefficient patterns.


clox-pp is a C++ implementation of a bytecode interpreter, like clox.


rclox is an implementation of a code-generating interpreter (somewhat similar to clox), in Rust

It uses a Rust enum for the instructions, rather than bytecode. This has the effect that jumps can have distance usize (usually 64 bits), rather than 16 bits.


This one is in Haskell. The parser is implemented using Megaparsec, a parser-combinators library.

This is also WIP.

Much of the code in cpplox and clox-pp (and to a lesser extent rclox) is very similar to the code from the book, which is available here under the MIT licence.

My code here is available under the terms of the Mozilla Public Licence, version 2.0