Files
rlox/example.lox
T
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

25 lines
416 B
Lox

// var Person :: struct {
// name: String,
// age: Int,
// address: String,
// }
// var func_name :: fn(param, param2) {param is Int} do
do
print "ciao";
1 + 2;
var cavallo = 1 + 2;
cavallo = cavallo + 1;
print cavallo;
cavallo
end
do
var cavallo = 0;
print "cavallo";
while cavallo < 10 do
cavallo = cavallo + 1;
print cavallo;
end
89
end
99