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
This commit is contained in:
+2
-1
@@ -13,10 +13,11 @@ do
|
||||
cavallo
|
||||
end
|
||||
do
|
||||
var cavallo = 0;
|
||||
print "cavallo";
|
||||
while cavallo < 10 do
|
||||
print "loop: " + cavallo;
|
||||
cavallo = cavallo + 1;
|
||||
print cavallo;
|
||||
end
|
||||
89
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user