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
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
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.