Skip to content

chamons/rusty-lox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rusty-lox

This is an implementation of lox in rust through chapter 24 of the book.

It contains:

  • User declared functions, with recursion
  • Built in timing function
  • Basic addition and order of operation

with a bytecode compiler from the book ported from C to Rust.

Show Me

% cat data/fib.lox                   
fun fib(n) {
  if (n < 2) return n;
  return fib(n - 2) + fib(n - 1);
}

var start = clock();
print fib(35);
print clock() - start;

% cargo run -q --release -- data/fib.lox
9227465
3.6996841430664063

Releases

No releases published

Packages

No packages published

Languages