3 ms·
Scoping is literally just a sequential list of associative lists to check in order. Nothing more than that. Its simple to implement as a stack of hash tables,
by andrewchambers 12y ago
Scoping is literally just a sequential list of associative lists to check in order. Nothing more than that.
Its simple to implement as a stack of hash tables, pushing a new hash table onto the stack when entering a scope, popping one off when you leave the scope. declarations add entries into the hash table at the top of the stack. Lookups traverse the stack top to bottom.