Modular Well-Definedness Analysis for Attribute Grammars

  • Ted Kaminski
  • Eric Van Wyk
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7745)


We present a modular well-definedness analysis for attribute grammars. The global properties of completeness and non-circularity are ensured with checks on grammar modules that require only additional information from their dependencies. Local checks to ensure global properties are crucial for specifying extensible languages. They allow independent developers of language extensions to verify that their extension, when combined with other independently developed and similarly verified extensions to a specified host language, will result in a composed grammar that is well-defined. Thus, the composition of the host language and user-selected extensions can safely be performed by someone with no expertise in language design and implementation. The analysis is necessarily conservative and imposes some restrictions on the grammar. We argue that the analysis is practical and the restrictions are natural and not burdensome by applying it to the Silver specifications of Silver, our boot-strapped extensible attribute grammar system.


Attribute Equation Concrete Syntax Modular Analysis Language Extension Attribute Grammar 
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.
    Backhouse, K.: A Functional Semantics of Attribute Grammars. In: Katoen, J.-P., Stevens, P. (eds.) TACAS 2002. LNCS, vol. 2280, pp. 142–157. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  2. 2.
    Bird, R.S.: Using circular programs to eliminate multiple traversals of data. Acta Informatica 21, 239–250 (1984)zbMATHCrossRefGoogle Scholar
  3. 3.
    Boyland, J.T.: Remote attribute grammars. J. ACM 52(4), 627–687 (2005)MathSciNetCrossRefGoogle Scholar
  4. 4.
    Bravenboer, M., Visser, E.: Concrete syntax for objects: domain-specific language embedding and assimilation without restrictions. In: Proc. of OOPSLA, pp. 365–383. ACM Press (2004)Google Scholar
  5. 5.
    Ekman, T., Hedin, G.: The JastAdd extensible Java compiler. In: Proc. of OOPSLA, pp. 1–18. ACM (2007)Google Scholar
  6. 6.
    Ekman, T., Hedin, G.: The JastAdd system - modular extensible compiler construction. Science of Computer Programming 69, 14–26 (2007)MathSciNetzbMATHCrossRefGoogle Scholar
  7. 7.
    Erdweg, S., Rendel, T., Kästner, C., Ostermann, K.: SugarJ: Library-based syntactic language extensibility. In: Proc. of OOPLSA. ACM (2011)Google Scholar
  8. 8.
    Hedin, G.: Reference attribute grammars. Informatica 24(3), 301–317 (2000)zbMATHGoogle Scholar
  9. 9.
    Kaminski, T., Van Wyk, E.: Integrating Attribute Grammar and Functional Programming Language Features. In: Sloane, A., Aßmann, U. (eds.) SLE 2011. LNCS, vol. 6940, pp. 263–282. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  10. 10.
    Kaminski, T., Van Wyk, E.: Evaluation of modular completeness analysis on Silver. Tech. Rep. No. 12-024, University of Minnesota, Department of Computer Science and Engineering,
  11. 11.
    Knuth, D.E.: Semantics of context-free languages. Mathematical Systems Theory 2(2), 127–145 (1968); corrections in 5, 95–96 (1971) MathSciNetzbMATHCrossRefGoogle Scholar
  12. 12.
    Krishnan, L., Van Wyk, E.: Termination Analysis for Higher-Order Attribute Grammars. In: Czarnecki, K., Hedin, G. (eds.) SLE 2012. LNCS, vol. 7745, Springer, Heidelberg (2012)Google Scholar
  13. 13.
    Saraiva, J., Swierstra, D.: Generic Attribute Grammars. In: 2nd Workshop on Attribute Grammars and their Applications, pp. 185–204 (1999)Google Scholar
  14. 14.
    Schwerdfeger, A., Van Wyk, E.: Verifiable composition of deterministic grammars. In: Proc. of PLDI. ACM (June 2009)Google Scholar
  15. 15.
    Sloane, A.M.: Lightweight Language Processing in Kiama. In: Fernandes, J.M., Lämmel, R., Visser, J., Saraiva, J. (eds.) GTTSE 2009. LNCS, vol. 6491, pp. 408–425. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  16. 16.
    Van Wyk, E., de Moor, O., Backhouse, K., Kwiatkowski, P.: Forwarding in Attribute Grammars for Modular Language Design. In: Nigel Horspool, R. (ed.) CC 2002. LNCS, vol. 2304, pp. 128–142. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  17. 17.
    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
  18. 18.
    Van Wyk, E., Krishnan, L., Schwerdfeger, A., Bodin, D.: Attribute Grammar-Based Language Extensions for Java. In: Ernst, E. (ed.) ECOOP 2007. LNCS, vol. 4609, pp. 575–599. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  19. 19.
    Van Wyk, E., Schwerdfeger, A.: Context-aware scanning for parsing extensible languages. In: Intl. Conf. on Generative Programming and Component Engineering (GPCE). ACM Press (October 2007)Google Scholar
  20. 20.
    Viera, M., Swierstra, S.D., Swierstra, W.: Attribute grammars fly first-class: How to do aspect oriented programming in Haskell. In: Proc. of 2009 International Conference on Functional Programming, ICFP 2009 (2009)Google Scholar
  21. 21.
    Visser, E.: Stratego: A Language for Program Transformation Based on Rewriting Strategies System Description of Stratego 0.5. In: Middeldorp, A. (ed.) RTA 2001. LNCS, vol. 2051, pp. 357–361. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  22. 22.
    Vogt, H.: Higher order attribute grammars. Ph.D. thesis, Department of Computer Science, Utrecht University, The Netherlands (1989)Google Scholar
  23. 23.
    Vogt, H., Swierstra, S.D., Kuiper, M.F.: Higher-order attribute grammars. In: ACM Conf. on Prog. Lang. Design and Implementation (PLDI), pp. 131–145 (1989)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Ted Kaminski
    • 1
  • Eric Van Wyk
    • 1
  1. 1.Department of Computer Science and EngineeringUniversity of MinnesotaMinneapolisUSA

Personalised recommendations