Static Name Resolution
In this lecture we study the definition of name binding patterns using the scope graph framework.
Slides
Further Reading
-
Gabriel D. P. Konat, Lennart C. L. Kats, Guido Wachsmuth, Eelco Visser. Declarative Name Binding and Scope Rules. Software Language Engineering, SLE 2012
This paper introduces NaBL, a declarative language for describing the name binding and scoping rules of programming languages. While the language is being replaced by the next generation NaBL2 in Spoofax, it is still an instructive read, not in the least since the NaBL design is arguably more elegant than NaBL2 (but less expressive).
-
Eelco Visser, Guido Wachsmuth, Andrew P. Tolmach, Pierre Neron, Vlad A. Vergu, Augusto Passalaqua, Gabriel D. P. Konat. A Language Designer’s Workbench. A one-stop-shop for implementation and verification of language designs.. Onward 2014
This paper outlines the vision of a language designer’s workbench that allows the description of a language design using high-level declarative meta-languages, which are used to derive implementations of various artifacts such as IDEs and interpreters, and are also the source for verification of safety properties. The paper also introduces the TS language for specification of type system rules to complement NaBL name binding rules.
-
Pierre Neron, Andrew Tolmach, Eelco Visser, Guido Wachsmuth. A Theory of Name Resolution. ESOP 2015
This award winning paper introduces scope graphs for describing the binding and scoping facts of programs. A resolution calculus describes how references resolve to declarations in terms of a reachability and visibility relation. A resolution algorithm is shown to be sound and complete with respect to the calculus.
-
Hendrik van Antwerpen, Pierre Neron, Andrew P. Tolmach, Eelco Visser, Guido Wachsmuth. A Constraint Language for Static Semantic Analysis based on Scope Graphs. PEPM 2016
This paper introduces a constraint language for name and type analysis based on scope graphs, a semantics for the language, and an algorithm for solving constraints. The paper shows an example of constraint generation for a toy language. This approach is the basis for the design of the NaBL2 language, which supports the definition of rules that transform an AST to a collection of constraints. The paper coins the term ‘type-dependent name resolution’ to characterize name resolutions that interact with type analysis.
Examples
- Tiger in Spoofax with name binding rules in NaBL2