Skip to content

v1.0.0 Full-featured Lox interpreter with classes and inheritance

Latest

Choose a tag to compare

@JDCodeWork JDCodeWork released this 08 Jan 20:01
· 27 commits to main since this release
b4068f2

✨ Highlights

  • Complete Lox language support: variables, assignments, control flow, functions, and closures.
  • Classes with init constructors, instance methods, and dynamic properties.
  • Single inheritance with super and proper this binding.
  • Dynamic object property access and mutation.
  • Tree-walk interpreter with detailed error reporting.

🏗️ Architecture

  • Full scanner (lexical analysis).
  • Recursive descent parser covering the full Lox grammar.
  • Static resolver for variable depth tracking (faster lookups).
  • Interpreter using an arena-style environment to manage scopes/closures without borrow-checker fights.
  • Error handling with line info and panic-mode recovery.

🚀 Usage

cargo build --release
./target/release/rslox             # REPL

🔍 Example (classes & inheritance)

class Animal {
  init(name) { this.name = name; }
  speak() { print this.name; }
}

class Dog < Animal {
  speak() {
    super.speak();
    print "Woof!";
  }
}

var dog = Dog("Rex");
dog.speak();

✅ Tests

cargo test

📄 Notes

See RELEASE_NOTES.md for full details and CHANGELOG.md for history.