Skip to content

Releases: JDCodeWork/rslox

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

Choose a tag to compare

@JDCodeWork JDCodeWork released this 08 Jan 20:01
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.

Functions, Closures & Resolution

Choose a tag to compare

@JDCodeWork JDCodeWork released this 28 Dec 20:43
33873cf

Release 0.9.0 — Functions, Closures & Resolution

I've significantly expanded the interpreter's capabilities by adding support for functions and a proper variable resolution system. This update brings the language much closer to being fully functional, enabling code reuse and complex scope management.

What I implemented:

  • Functions: Added support for function declarations, calls, and return statements.
  • Closures: Implemented lexical scoping and closures, allowing functions to capture their environment.
  • Resolver: Added a semantic analysis pass to resolve variables correctly and handle scope validation.
  • Native Functions: Included support for native functions, starting with clock().

I also added comprehensive unit tests to ensure functions, closures, and scoping rules work as expected.

Control Flow & Logic

Choose a tag to compare

@JDCodeWork JDCodeWork released this 08 Dec 02:36
123e8d3

Release 0.8.0 — Control Flow & Logic

I've updated the interpreter to handle control flow and logical operations. It can now make decisions and loop through code, moving closer to a complete language.

What I implemented:

  • Control Flow: Added if-else statements for conditional execution.
  • Loops: Implemented while and for loops.
  • Logical Operators: Added and and or operators with short-circuit evaluation.

I also added unit tests to verify that these control structures and operators work correctly.

Full Changelog: v0.7.0...v0.8.0

v0.7.0 - Variables, Scopes & Print

Choose a tag to compare

@JDCodeWork JDCodeWork released this 19 Nov 21:15
9c56d07

📦 Release 0.7.0 — Variables & Scopes

I've updated the interpreter to handle state. It's not just a calculator anymore; it can finally remember values and handle logic flow.

🛠️ What I implemented:

  • Variables: Added var declarations and assignments. I built the Environment struct to handle variable storage and lookups.
  • Scopes: Added support for blocks { ... }. Lexical scoping and shadowing are working correctly now.
  • Print: Added the print statement to output values.

I also added unit tests to verify that variable resolution and scoping rules work as expected.

Parser, Interpreter & Runtime Error Handling

Choose a tag to compare

@JDCodeWork JDCodeWork released this 31 Oct 01:49
303e45a

📦 Release 0.6.0 — Parser, Interpreter & Runtime Error Handling

✨ Major Features

This major release marks a significant milestone for rslox — the language can now parse and evaluate expressions!

🎯 Core Language Features:

✅ Full Expression Parser:

  • Binary operators: arithmetic (+, -, *, /), comparison (>, >=, <, <=), equality (==, !=)
  • Unary operators: negation (-), logical NOT (!)
  • Grouping expressions with parentheses
  • Literal support: numbers, strings, booleans, nil
  • Proper operator precedence and associativity

🚀 Interpreter with Evaluation:

  • Complete expression evaluation system
  • String concatenation support ("hello" + " world")
  • Type checking for operations
  • Runtime error detection:
    • Division by zero prevention
    • Type validation (e.g., can't negate a string)
    • Invalid operation detection

🛡️ Robust Error System:

  • Separated error types for better debugging:
    • ScanErr — Lexical analysis errors
    • ParseErr — Syntax errors
    • RuntimeErr — Execution errors
    • SystemErr — File and IO errors
  • Detailed error messages with line/position information
  • Parse error recovery with synchronize() for REPL resilience

🧪 Quality Improvements:

✅ Unit Tests:

  • Comprehensive interpreter tests
  • Type error validation tests

🔄 Type System Refactor:

  • Literal refactored from struct to enum with typed variants:
    • Literal::Number(f64)
    • Literal::String(String)
    • Literal::Boolean(bool)
    • Literal::Nil
  • Better type safety and pattern matching

📚 Usage Examples:

Evaluate arithmetic expressions:

echo "1 + 2 * 3" | cargo run -- run
# Output: Number(7.0)

String concatenation:

echo '"Hello" + " " + "World"' | cargo run -- run
# Output: String("Hello World")

Runtime error handling:

echo "10 / 0" | cargo run -- run
# ERROR RUNTIME | Division by zero.

Debug mode with AST:

cargo run -- run -p playground/factorial.lox --show-ast

CLI Improvements & Debug Options

Choose a tag to compare

@JDCodeWork JDCodeWork released this 13 Sep 22:41
75eb8d6

📦 Release 0.5.1CLI Improvements & Debug Options

Features
This minor release delivers the planned improvements from 0.5.0, focusing on better CLI experience and debugging capabilities!

🎯 Debug Command Enhancements:

  • Granular Debug Options: AST printing moved out of run command as planned
    • --debug: Comprehensive debug mode (shows both tokens and AST)
    • --show-ast: Display only the Abstract Syntax Tree
    • --show-tokens: Display only the tokenized output
  • 🎮 Clean Run Experience: The run command now executes cleanly without forcing AST output

🚀 CLI Improvements:

  • 📁 Smart File Handling: Automatic .lox extension detection and validation
  • 💬 Enhanced REPL Mode: Better interactive prompt experience when no file is provided
  • 🎨 Professional Alerts: Color-coded messages with consistent formatting (success/warning/info/error)
  • 🛡️ Better Error Reporting: Structured error handling with proper exit codes

📚 Usage Examples:

Run with AST debug (replaces old default behavior):

cargo run -- run -p example --debug

Clean execution (new default):

cargo run -- run -p example

First Syntax Tree

Choose a tag to compare

@JDCodeWork JDCodeWork released this 16 Apr 00:27

📦 Release 0.5.0First Syntax Tree

✨ Features

First version of rslox capable of generating syntax trees!

rslox is a Rust implementation of the Lox language, based on the book Crafting Interpreters. This release completes the Parsing Expressions section, allowing the language to convert a sequence of tokens into a correctly structured AST (Abstract Syntax Tree).

✅ Highlights:

  • 📖 Implemented the Parsing Expressions section from Crafting Interpreters.
  • 📝 Support for arithmetic expressions with correct operator precedence and associativity.
  • 🛠️ The run command now prints the generated AST for each entered expression.
  • 🎨 Significant CLI improvements, including:
    • New parameters and commands
    • Colored output for better readability
    • Improved command-line feedback and structure

📚 Example:

Expression:

1 + 2 * (3 - 4) / 5

AST:

(+ 1 (/ (* 2 (group (- 3 4))) 5))

⚠️ Warnings

  • rslox currently does not support keywords.
  • If a keyword (such as print, fun, if, return…) is found during interpretation, the program will raise an error and exit immediately with exit code 1.
  • Because of this, the example file located in the playground will fail to run, as it contains unsupported keywords.

🛠️ Usage

Run an expression and print its AST:

cargo run -- run

Then enter expressions like:

(1 + 2) * 3

🚀 Next Steps (0.5.1)

  • Add a debug command with the --ast option to optionally print the AST, moving this functionality out of the run command.

✍️ Based on: Crafting Interpreters by Bob Nystrom

v0.4.0 - Essential Scanner Features Complete

Choose a tag to compare

@JDCodeWork JDCodeWork released this 15 Jan 16:33

This release finalizes the essential functionality of the scanner, marking a major milestone in the interpreter's development. Key features include:

  • Identifiers and Reserved Words: Support for detecting alphanumeric identifiers and reserved words based on a predefined list.
  • Block Comments: Support for block comments using the syntax /* ... */, enabling multi-line or inline comments to be ignored during scanning.

With these additions, the scanner is now fully equipped to handle the core elements required for code analysis.