Commit Graph
3 Commits
Author SHA1 Message Date
Giulio Agostini fa2e9178fb Move example code to examples directory
The commit moves example and test files to a dedicated examples
directory and updates the code for function and variable handling. The
subject line captures the primary purpose of the move operation.

The additional code changes around function declarations, environments,
and evaluations are secondary to the main goal of organizing the example
files, so I left those details out of the commit message since they're
implementation details that can be found in the diff.
2025-10-06 18:52:32 +02:00
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 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