/rubylox

Lox from Crafting Interpreters written in Ruby

Primary LanguageRubyMIT LicenseMIT

Rubylox

This is a Ruby 3.x interpreter of the Lox programming language from Crafting Interpreters

Usage

  1. Clone the repo
  2. Run bundle install
  3. Run bundle exec exe/rubylox lox_programs/fibonacci.lox or whatever script you want to run.

Features/Chapters Implemented

  • Scanning
  • Parsing
  • Evaluating
  • Statements
  • Expressions
  • Control Flow
  • Function Calling
  • Function Definition
  • Resolving and Binding
  • Classes
  • Inheritance

Some things that could be done

  • Overall Cleanup
  • Better error handling and reporting
  • Better test coverage
  • CLI REPL
  • Extra exercises from the book
  • Maybe extra features not in the book

Benchmarks

I've run benchmarks against the oficial Java implementation from the book in my Macbook Air M1 2020. It's uuhh... pretty slow. benchmarks1 benchmarks2 benchmarks_fib