Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 582 Bytes

README.md

File metadata and controls

28 lines (21 loc) · 582 Bytes

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