Declarative Name Binding and Scope Rules

  • Gabriël Konat
  • Lennart Kats
  • Guido Wachsmuth
  • Eelco Visser
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7745)


In textual software languages, names are used to reference elements like variables, methods, classes, etc. Name resolution analyses these names in order to establish references between definition and use sites of elements. In this paper, we identify recurring patterns for name bindings in programming languages and introduce a declarative metalanguage for the specification of name bindings in terms of namespaces, definition sites, use sites, and scopes. Based on such declarative name binding specifications, we provide a language-parametric algorithm for static name resolution during compile-time. We discuss the integration of the algorithm into the Spoofax Language Workbench and show how its results can be employed in semantic editor services like reference resolution, constraint checking, and content completion.


Resolution Algorithm Attribute Grammar Abstract Syntax Tree Constraint Check Variable Declaration 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Standard ECMA-334 C# language specification, 4th edn (2006)Google Scholar
  2. 2.
    Åkesson, J., Ekman, T., Hedin, G.: Implementation of a Modelica compiler using JastAdd attribute grammars. Science of Computer Programming 75(1-2), 21–38 (2010)MathSciNetzbMATHCrossRefGoogle Scholar
  3. 3.
    Bravenboer, M., van Dam, A., Olmos, K., Visser, E.: Program transformation with scoped dynamic rewrite rules. Fundamenta Informaticae 69(1-2), 123–178 (2006)MathSciNetzbMATHGoogle Scholar
  4. 4.
    Bürger, C., Karol, S., Wende, C., Aßmann, U.: Reference Attribute Grammars for Metamodel Semantics. In: Malloy, B., Staab, S., van den Brand, M. (eds.) SLE 2010. LNCS, vol. 6563, pp. 22–41. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  5. 5.
    Ekman, T., Hedin, G.: The JastAdd extensible Java compiler. In: Gabriel, R.P., Bacon, D.F., Lopes, C.V. (eds.) Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2007, pp. 1–18. ACM (2007)Google Scholar
  6. 6.
    Eysholdt, M., Behrens, H.: Xtext: implement your language faster than the quick and dirty way. In: Int. Conference Companion on Object Oriented Programming Systems Languages and Applications Companion, pp. 307–309. ACM (2010)Google Scholar
  7. 7.
    Hedin, G.: An Introductory Tutorial on JastAdd Attribute Grammars. In: Fernandes, J.M., Lämmel, R., Visser, J., Saraiva, J. (eds.) GTTSE 2009. LNCS, vol. 6491, pp. 166–200. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  8. 8.
    Heidenreich, F., Johannes, J., Karol, S., Seifert, M., Wende, C.: Derivation and Refinement of Textual Syntax for Models. In: Paige, R.F., Hartman, A., Rensink, A. (eds.) ECMDA-FA 2009. LNCS, vol. 5562, pp. 114–129. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  9. 9.
    Heidenreich, F., Johannes, J., Reimann, J., Seifert, M., Wende, C., Werner, C., Wilke, C., A§mann, U.: Model-driven modernisation of java programs with jamopp. In: Joint Proceedings of MDSM 2011 and SQM 2011. CEUR Workshop Proceedings, pp. 8–11 (March 2011)Google Scholar
  10. 10.
    Hemel, Z., Groenewegen, D.M., Kats, L.C.L., Visser, E.: Static consistency checking of web applications with WebDSL. Journal of Symbolic Computation 46(2), 150–182 (2011)zbMATHCrossRefGoogle Scholar
  11. 11.
    Hemel, Z., Kats, L.C.L., Groenewegen, D.M., Visser, E.: Code generation by model transformation: a case study in transformation modularity. Software and Systems Modeling 9(3), 375–402 (2010)CrossRefGoogle Scholar
  12. 12.
    Hemel, Z., Visser, E.: Declaratively programming the mobile web with mobl. In: Fisher, K., Lopes, C.V. (eds.) 2011 Int. Conference on Object Oriented Programming Systems Languages and Applications, OOPSLA 2011, pp. 695–712. ACM (2011)Google Scholar
  13. 13.
    Kastens, U., Waite, W.M.: Modularity and reusability in attribute grammars. Acta Inf. 31(7), 601–627 (1994)zbMATHCrossRefGoogle 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.) Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2010, pp. 444–463. ACM (2010)Google Scholar
  15. 15.
    Kats, L.C.L., Visser, E., Wachsmuth, G.: Pure and declarative syntax definition: paradise lost and regained. In: Cook, W.R., Clarke, S., Rinard, M.C. (eds.) Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2010, pp. 918–932. ACM (2010)Google Scholar
  16. 16.
    Knuth, D.E.: Semantics of context-free languages. Theory Comput. Syst. 2(2), 127–145 (1968)MathSciNetzbMATHGoogle Scholar
  17. 17.
    Meyer, J., Downing, T.: Java Virtual Machine. O Reilly (1997)Google Scholar
  18. 18.
    Object Management Group: Human Usable Textual Notation Specification (2004)Google Scholar
  19. 19.
    Object Management Group: Object Constraint Language, 2.3.1 edn. (2012)Google Scholar
  20. 20.
    Odersky, M.: Defining context-dependent syntax without using contexts. Transactions on Programming Languages and Systems 15(3), 535–562 (1993)CrossRefGoogle Scholar
  21. 21.
    Poetzsch-Heffter, A.: Logic-based specification of visibility rules. In: PLILP, pp. 63–74 (1991)Google Scholar
  22. 22.
    Poetzsch-Heffter, A.: Implementing High-Level Identification Specifications. In: Pfahler, P., Kastens, U. (eds.) CC 1992. LNCS, vol. 641, pp. 59–65. Springer, Heidelberg (1992)CrossRefGoogle Scholar
  23. 23.
    Steinberg, D., Budinsky, F., Paternostro, M., Merks, E.: Eclipse Modeling Framework, 2nd edn. Addison-Wesley (2009)Google Scholar
  24. 24.
    Visser, E.: Syntax Definition for Language Prototyping. Ph.D. thesis, University of Amsterdam (September 1997)Google Scholar
  25. 25.
    Visser, E.: Program Transformation with Stratego/XT. In: Lengauer, C., Batory, D., Blum, A., Odersky, M. (eds.) Domain-Specific Program Generation. LNCS, vol. 3016, pp. 216–238. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  26. 26.
    Van Wyk, E., Bodin, D., Gao, J., Krishnan, L.: Silver: An extensible attribute grammar system. Science of Computer Programming 75(1-2), 39–54 (2010)MathSciNetzbMATHCrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Gabriël Konat
    • 1
  • Lennart Kats
    • 1
  • Guido Wachsmuth
    • 1
  • Eelco Visser
    • 1
  1. 1.Delft University of TechnologyThe Netherlands

Personalised recommendations