Expand description
Variable resolution pass - runs between parsing and evaluation.
The resolver walks the AST and transforms unresolved name references
into slot-indexed lookups (depth, slot), eliminating string-based
name lookups at runtime.
depth- how many scopes up from the current scope the variable livesslot- the index of the variable within that scope’s slot array
Unresolved Identifier nodes become ResolvedIdentifier { depth, slot }.
Unresolved Assign nodes become ResolvedAssign { depth, slot, value }.
Function and lambda bodies are resolved in their own pushed scope.
Import statements are read from disk, lexed, parsed, and resolved inline.
Modules§
- expressions 🔒
- Expression resolution - transforms name references into indexed lookups.
- statements 🔒
- Statement resolution - transforms declarations and control flow into slot-indexed variants and resolves import statements at compile time.
Structs§
- Resolver
- Walks the AST and resolves all name references to
(depth, slot)pairs.