Commit Graph
3 Commits
Author SHA1 Message Date
Giulio Agostini 827349cbad Refactor environment to use stack-based scoping
The commit rewrites the environment to use a stack of hash maps for
managing variable scopes. This replaces the old parent-reference
approach with a simpler and more efficient stack-based model.

Key changes: - Rename Environment to EnvironmentStack - Store scopes in
a Vec of HashMaps - Add push/pop scope operations for block handling -
Update interpreter to properly manage scope lifetimes - Clean up error
handling with helper functions
2025-10-04 21:05:00 +02:00
Giulio Agostini 41253e932a Add source location tracking to AST nodes
The commit expands the source location tracking through the AST by:

1. Switching from raw Expr/Stmt nodes to AstNode wrappers containing
source slices 2. Updating interpreter and parser to preserve location
info through node traversal 3. Enhancing error reporting with richer
source context information
2025-10-04 19:02:33 +02:00
Giulio Agostini a7df45dc72 Initialize Rust implementation of Lox interpreter
This initial commit sets up the basic structure for a Rust
implementation of the Lox interpreter, including:

- Lexer for tokenizing source code - Parser for building AST - Basic
interpreter functionality - Environment for variable storage

The core components include source tracking, error handling, and basic
expression evaluation.
2025-10-03 19:07:12 +02:00