3 releases
0.0.3 | May 12, 2020 |
---|---|
0.0.2 | May 11, 2020 |
0.0.1 | May 10, 2020 |
#21 in #lox
125KB
3.5K
SLoC
lox-lang: a Lox runtime for Rust projects
Lox is a (mostly) toy scripting language designed by Bob Nystrom for his book Crafting Interpreters. This library (and the included wrapper binary) implement a virtual machine runtime for it that can be used on its own or embedded into a larger application. See the crate documentation for usage information.
lib.rs
:
An implementation of the Lox programming language.
About Lox
Lox is a dynamically typed, interpreted scripting language. It was designed by Bob Nystrom for his book Crafting Interpreters.
About this implementation
This library aims to implement Lox faithfully to the quasi-specification laid out in the book, as well as some language extensions suggested as exercises to the reader. It is loosely based off of the book's third part, which is a guide to implementing an interpreter in C.
Usage
Included in this package (and installable via cargo install lox_lang
) is a small wrapper
executable named loxi
. It is the simplest route to trying out the Lox language.
If you want to embed Lox in a larger Rust project, you will need to create an instance of
VM
and use its interpret
method to run
your code:
let mut my_vm = lox_lang::VM::default();
my_vm.interpret(r#" print "hello " + "world"; "#).unwrap();
Dependencies
~5.5MB
~111K SLoC