A Theory of Name Resolution

  • Pierre NeronEmail author
  • Andrew Tolmach
  • Eelco Visser
  • Guido Wachsmuth
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9032)


We describe a language-independent theory for name binding and resolution, suitable for programming languages with complex scoping rules including both lexical scoping and modules. We formulate name resolution as a two-stage problem. First a language-independent scope graph is constructed using language-specific rules from an abstract syntax tree. Then references in the scope graph are resolved to corresponding declarations using a language-independent resolution process. We introduce a resolution calculus as a concise, declarative, and languageindependent specification of name resolution. We develop a resolution algorithm that is sound and complete with respect to the calculus. Based on the resolution calculus we develop language-independent definitions of α-equivalence and rename refactoring. We illustrate the approach using a small example language with modules. In addition, we show how our approach provides a model for a range of name binding patterns in existing languages.


Binding Pattern Resolution Algorithm Abstract Syntax Tree Code Completion Visibility Policy 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Aho, A.V., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools. Addison-Wesley (1986)Google Scholar
  2. 2.
    Aydemir, B.E., Charguéraud, A., Pierce, B.C., Pollack, R., Weirich, S.: Engineering formal metatheory. In: Necula, G.C., Wadler, P. (eds.) Proceedings of the 35th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2008, San Francisco, California, USA, January 7-12, pp. 3–15. ACM (2008)Google Scholar
  3. 3.
    Charguéraud, A.: The locally nameless representation. Journal of Automated Reasoning 49(3), 363–408 (2012)CrossRefzbMATHMathSciNetGoogle Scholar
  4. 4.
    Cheney, J.: Toward a general theory of names: binding and scope. In: Pollack, R. (ed.) ACM SIGPLAN International Conference on Functional Programming, Workshop on Mechanized Reasoning About Languages with Variable Binding, MERLIN 2005, Tallinn, Estonia, pp. 33–40. ACM (September 30, 2005)Google Scholar
  5. 5.
    Chlipala, A.J.: A verified compiler for an impure functional language. In: Hermenegildo, M.V., Palsberg, J. (eds.) Proceedings of the 37th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2010, Madrid, Spain, January 17-23, pp. 93–106. ACM (2010)Google Scholar
  6. 6.
    Churchill, M., Mosses, P.D., Torrini, P.: Reusable components of semantic specifications. In: Binder, W., Ernst, E., Peternier, A., Hirschfeld, R. (eds.) 13th International Conference on Modularity, MODULARITY 2014, Lugano, Switzerland, April 22-26, pp. 145–156. ACM (2014)Google Scholar
  7. 7.
    de Bruijn, N.G.: Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the Church-Rosser theorem. Indagationes Mathematicae 34(5), 381–392 (1972)CrossRefGoogle Scholar
  8. 8.
    Dybvig, R.K., Hieb, R., Bruggeman, C.: Syntactic abstraction in scheme. Higher-Order and Symbolic Computation 5(4), 295–326 (1992)Google Scholar
  9. 9.
    Erdweg, S., van der Storm, T., Dai, Y.: Capture-avoiding and hygienic program transformations. In: Jones, R. (ed.) ECOOP 2014. LNCS, vol. 8586, pp. 489–514. Springer, Heidelberg (2014)CrossRefGoogle Scholar
  10. 10.
    Gabbay, M., Pitts, A.M.: A new approach to abstract syntax with variable binding. Formal Asp. Comput. 13(3-5), 341–363 (2002)CrossRefzbMATHGoogle Scholar
  11. 11.
    Hedin, G., Magnusson, E.: Jastadd–an aspect-oriented compiler construction system. Science of Computer Programming 47(1), 37–58 (2003)CrossRefzbMATHMathSciNetGoogle Scholar
  12. 12.
    Herman, D.: A Theory of Hygienic Macros. PhD thesis, Northeastern University, Boston, Massachusetts (May 2010)Google Scholar
  13. 13.
    Herman, D., Wand, M.: A theory of hygienic macros. In: Drossopoulou, S. (ed.) ESOP 2008. LNCS, vol. 4960, pp. 48–62. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  14. 14.
    Kats, L.C.L., Visser, E.: The Spoofax language workbench: rules for declarative specification of languages and IDEs. In: Cook, W.R., Clarke, S., Rinard, M.C. (eds.) Proceedings of the 25th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2010, Reno/Tahoe, Nevada, pp. 444–463. ACM (2010)Google Scholar
  15. 15.
    Klein, C., Clements, J., Dimoulas, C., Eastlund, C., Felleisen, M., Flatt, M., McCarthy, J.A., Rafkind, J., Tobin-Hochstadt, S., Findler, R.B.: Run your research: on the effectiveness of lightweight mechanization. In: Field, J., Hicks, M. (eds.) Proceedings of the 39th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2012, Philadelphia, Pennsylvania, USA, January 22-28, pp. 285–296. ACM (2012)Google Scholar
  16. 16.
    Konat, G., Kats, L., Wachsmuth, G., Visser, E.: Declarative name binding and scope rules. In: Czarnecki, K., Hedin, G. (eds.) SLE 2012. LNCS, vol. 7745, pp. 311–331. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  17. 17.
    Leroy, X., Doligez, D., Frisch, A., Garrigue, J., Rémy, D., Vouillon, J.: The OCaml system (release 4.00): Documentation and user’s manual. Institut National de Recherche en Informatique et en Automatique (July 2012)Google Scholar
  18. 18.
    Mosses, P.D.: Modular structural operational semantics. Journal of Logic and Algebraic Programming 61-61, 195–228 (2004)CrossRefMathSciNetGoogle Scholar
  19. 19.
    Neron, P., Tolmach, A.P., Visser, E., Wachsmuth, G.: A theory of name resolution with extended coverage and proofs. Technical Report TUD-SERG-2015-001, Software Engineering Research Group. Delft University of Technology, Extended version of this paper (January 2015)Google Scholar
  20. 20.
    Pfenning, F., Elliott, C.: Higher-order abstract syntax. In: Wexelblat, R.L. (ed.) Proceedings of the ACM SIGPLAN 1988 Conference on Programming Language Design and Implementation (PLDI), Atlanta, Georgia, USA, June 22-24, pp. 199–208. ACM (1988)Google Scholar
  21. 21.
    Pierce, B.C.: Types and Programming Languages. MIT Press, Cambridge (2002)Google Scholar
  22. 22.
    Sewell, P., Nardelli, F.Z., Owens, S., Peskine, G., Ridge, T., Sarkar, S., Strnisa, R.: Ott: Effective tool support for the working semanticist. Journal of Functional Programming 20(1), 71–122 (2010)CrossRefzbMATHGoogle Scholar
  23. 23.
    Stansifer, P., Wand, M.: Romeo: A system for more flexible binding-safe programming. In: Jeuring, J., Chakravarty, M.M.T. (eds.) Proceedings of the 19th ACM SIGPLAN International Conference on Functional Programming, Gothenburg, Sweden, September 1-3, pp. 53–65. ACM (2014)Google Scholar
  24. 24.
    Visser, E., Wachsmuth, G., Tolmach, A.P., Neron, P., Vergu, V.A., Passalaqua, A., Konat, G.D.P.: A language designer’s workbench: A one-stop-shop for implementation and verification of language designs. In: Black, A.P., Krishnamurthi, S., Bruegge, B., Ruskiewicz, J.N. (eds.) Onward! 2014, Proceedings of the 2014 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming & Software, part of SLASH 2014, Portland, OR, USA, October 20-24, pp. 95–111. ACM (2014)Google Scholar
  25. 25.
    Weirich, S., Yorgey, B.A., Sheard, T.: Binders unbound. In: Chakravarty, M.M.T., Hu, Z., Danvy, O. (eds.) Proceeding of the 16th ACM SIGPLAN International Conference on Functional Programming, ICFP 2011, Tokyo, Japan, September 19-21, pp. 333–345. ACM (2011)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2015

Authors and Affiliations

  • Pierre Neron
    • 1
    Email author
  • Andrew Tolmach
    • 2
  • Eelco Visser
    • 1
  • Guido Wachsmuth
    • 1
  1. 1.Delft University of TechnologyDelftThe Netherlands
  2. 2.Portland State UniversityPortlandUSA

Personalised recommendations