Releases: JDCodeWork/rslox
Release list
v1.0.0 Full-featured Lox interpreter with classes and inheritance
✨ Highlights
- Complete Lox language support: variables, assignments, control flow, functions, and closures.
- Classes with
initconstructors, instance methods, and dynamic properties. - Single inheritance with
superand properthisbinding. - 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
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
returnstatements. - 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
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-elsestatements for conditional execution. - Loops: Implemented
whileandforloops. - Logical Operators: Added
andandoroperators 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
📦 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
vardeclarations and assignments. I built theEnvironmentstruct to handle variable storage and lookups. - Scopes: Added support for blocks
{ ... }. Lexical scoping and shadowing are working correctly now. - Print: Added the
printstatement to output values.
I also added unit tests to verify that variable resolution and scoping rules work as expected.
Parser, Interpreter & Runtime Error Handling
📦 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 errorsParseErr— Syntax errorsRuntimeErr— Execution errorsSystemErr— 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:
Literalrefactored 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-astCLI Improvements & Debug Options
📦 Release 0.5.1 — CLI 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
runcommand 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
runcommand now executes cleanly without forcing AST output
🚀 CLI Improvements:
- 📁 Smart File Handling: Automatic
.loxextension 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 --debugClean execution (new default):
cargo run -- run -p exampleFirst Syntax Tree
📦 Release 0.5.0 — First 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
runcommand 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
rsloxcurrently 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 code1. - Because of this, the
examplefile located in theplaygroundwill fail to run, as it contains unsupported keywords.
🛠️ Usage
Run an expression and print its AST:
cargo run -- runThen enter expressions like:
(1 + 2) * 3
🚀 Next Steps (0.5.1)
- Add a
debugcommand with the--astoption to optionally print the AST, moving this functionality out of theruncommand.
✍️ Based on: Crafting Interpreters by Bob Nystrom
v0.4.0 - Essential Scanner Features Complete
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.