Env
A lexically-scoped symbol table that maps MiniKotlin source names to their generated Java names and VarType.
Each syntactic block creates a child Env(parent) so that bindings introduced inside the block do not leak into the enclosing scope. Lookup walks the parent chain, so inner scopes can read bindings from outer scopes.
Example scope chain for:
fun f(x: Int): Int { // Env A: x -> (x, PARAM)
var y: Int = x + 1 // Env B (child of A): y -> (y_0, VAR)
return y
}Content copied to clipboard