[][src]Crate lox_lang

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();

Modules

lox_std

Structs

Error

Compilation and runtime errors in the Lox VM.

VM

The Lox virtual machine.

Enums

ErrorCategory

Where in the pipeline an error occurred.

Value

Underlying representation of runtime values in Lox.

Type Definitions

NativeFun

A natively-implemented function that can be called from Lox code.