Forwarding in Attribute Grammars for Modular Language Design

  • Eric Van Wyk
  • Oege de Moor
  • Kevin Backhouse
  • Paul Kwiatkowski
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2304)


Forwarding is a technique for providing default attribute definitions in attribute grammars that is helpful in the modular implementation of programming languages. It complements existing techniques such as default copy rules. This paper introduces forwarding, and shows how it is but a small extension of standard higher-order attribute grammars. The usual tools for manipulating higher-order attribute grammars, including the circularity check (which tests for cyclic dependencies between attribute values), carry over without modification. The closure test (which checks that each attribute has a defining equation) needs modification, however, because the resulting higher-order attribute grammars may contain spurious attributes that are never evaluated, and indeed that need not be defined.


Dependency Relation Attribute Evaluation Context Free Grammar Semantic Function Syntax Tree 
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.
    S. Adams. Modular Attribute Grammars for Programming Language Prototyping. Ph.D. thesis, University of Southampton, 1991.Google Scholar
  2. 2.
    K. S. Backhouse. A functional semantics of attribute grammars. In International Conference on Tools and Algorithms for Construction and Analysis of Systems, Lecture Notes in Computer Science. Springer-Verlag, 2002.Google Scholar
  3. 3.
    A. Carle. Hierarchical attribute grammars: Dialects, applications and evaluation algorithms. Technical Report TR93-270, Department of Computer Science, Rice University, 1993.Google Scholar
  4. 4.
    L. Correnson, E. Duris, D. Parigot, and G. Roussel. Declarative program transformation: a deforestation case-study. In G. Nadathur, editor, Principles and Practice of Declarative Programming, volume 1702, pages 353–369. Lecture Notes in Computer Science, 1999.CrossRefGoogle Scholar
  5. 5.
    O. Danvy and L. R. Nielsen. Defunctionalization at work. In Third International Conference on Principles and Practice of Declarative Programming (PPDP 01). ACM Press, 2001.Google Scholar
  6. 6.
    O. de Moor, K. Backhouse, and S. D. Swierstra. First-class attribute grammars. Informatica, 24(3), 2000.Google Scholar
  7. 7.
    O. de Moor, S. Peyton-Jones, and E. Van Wyk. Aspect-oriented compilers. In First International Symposium on Generative and Component-based Software Engineering, Lecture Notes in Computer Science. Springer-Verlag, 1999.Google Scholar
  8. 8.
    G. D. P. Dueck and G. V. Cormack. Modular attribute grammars. Computing Journal, 33:164–172, 1990.CrossRefGoogle Scholar
  9. 9.
    Dawson R. Engler, Wilson C. Hsieh, and M. Frans Kaashoek. ‘c: A language for high-level, efficient, and machine-independent dynamic code generation’. In Symposium on Principles of Programming Languages, pages 131–144, 1996.Google Scholar
  10. 10.
    R. Farrow, T. J. Marlowe, and D. M. Yellin. Composable attribute grammars: Support for modularity in translator design and implementation. In Proceedings of the ACM Symposium on Principles of Programming Languages, pages 223–234. ACM Press, 1992.Google Scholar
  11. 11.
    H. Ganzinger and R. Giegerich. Attribute coupled grammars. SIGPLAN Notices, 19:157–170, 1984.CrossRefGoogle Scholar
  12. 12.
    J. A. Goguen. Higher-order functions considered unnecessary for higher-order programming. In D. A. Turner, editor, Research Topics in Functional Programming, pages 309–351. Addison-Welsey, Reading, MA, 1990.Google Scholar
  13. 13.
    G. Hedin. An object-oriented notation for attribute grammars. In Proceedings of the European Conference on Object-Oriented Programming, ECOOP’89. Cambridge University Press, 1989.Google Scholar
  14. 14.
    Gorel Hedin. Reference Attributed Grammars. In D. Parigot and M. Mernik, editors, Second Workshop on Attribute Grammars and their Applications, WAGA’99, pages 153–172, Amsterdam, The Netherlands, 1999. INRIA rocquencourt.Google Scholar
  15. 15.
    T. Johnsson. Attribute grammars as a functional programming paradigm. In G. Kahn, editor, Functional Programming Languages and Computer Architecture, volume 274 of Lecture Notes in Computer Science, pages 154–173. Springer-Verlag, 1987.Google Scholar
  16. 16.
    S. Jones and J. Hughes. Haskell98: A non-strict purely functional language.Google Scholar
  17. 17.
    U. Kastens and W. M. Waite. Modularity and reusability in attribute grammars. Acta Informatica, 31:601–627, 1994.zbMATHCrossRefGoogle Scholar
  18. 18.
    D. E. Knuth. Semantics of context-free languages. Mathematical Systems Theory, 2(2):127–146, 1968. Corrections in 5(2):95-96, 1971.zbMATHCrossRefMathSciNetGoogle Scholar
  19. 19.
    C. Le Bellec, M. Jourdan, D. Parigot, and G. Roussel. Specification and implementation of grammar coupling using attribute grammars. In M. Bruynooghe and J. Penjam, editors, Programming Language Implementation and Logic Programming (PLILP’ 93), volume 714 of Lecture Notes in Computer Science, pages 123–136. Springer-Verlag, 1993.Google Scholar
  20. 20.
    W Maddox. Semantically-sensitive macroprocessing. Master’s thesis, The University of California at Berkeley, Computer Science Division (EECS), Berkeley, CA 94720, December 1989.Google Scholar
  21. 21.
    M. Mernik, M. Lenic, E. Avdicausevic, and V. Zumer. Multiple attribute grammar inheritance. Informatica, 24(3):319–328, 2000.zbMATHGoogle Scholar
  22. 22.
    D. Parigot, E. Duris, G. Roussel, and M. Jourdan. Attribute grammars: a declarative functional language. Rapport de Recherche 2662, INRIA, 1995.Google Scholar
  23. 23.
    T. W. Reps and T. Teitelbaum. The Synthesizer Generator: A system for constructing language-based editors. Texts and Monographs in Computer Science. Springer-Verlag, 1989.Google Scholar
  24. 24.
    J. C. Reynolds. Definitional interpreters for higher-order programming languages. Higher-order and symbolic computation, 11(4):363–397, 1998. Reprinted from the proceedings of the 25th ACM National Conference (1972).zbMATHCrossRefGoogle Scholar
  25. 25.
    Joao Saraiva and Doaitse Swierstra. Generic Attribute Grammars. In D. Parigot and M. Mernik, editors, Second Workshop on Attribute Grammars and their Applications, WAGA’99, pages 185–204, Amsterdam, The Netherlands, 1999. INRIA rocquencourt.Google Scholar
  26. 26.
    Tim Sheard. Using metaml: A staged programming language. In Advanced Functional Programming, pages 207–239, 1998.Google Scholar
  27. 27.
    C. Simonyi. Intentional programming: Innovation in the legacy age. Presented at IFIP Working group 2.1. Available from URL, 1996.
  28. 28.
    S. D. Swierstra. Simple, functional attribute grammars., 1999.
  29. 29.
    T. Teitelbaum and R. Chapman. Higher-order attribute grammars and editing environments. In ACM Sigplan’ 90 Conference on Programming Languages Design and Implementation, pages 197–208, 1990.Google Scholar
  30. 30.
    E. Van Wyk, O. de Moor, G. Sittampalam, I. Sanabria-Piretti, K. Backhouse, and P. Kwiatkowski. Intentional programming: a host of language features. Technical Report PRG-RR-01-15, Computing Laboratory, University of Oxford, 2001.Google Scholar
  31. 31.
    H. Vogt. Higher order attribute grammars. PhD thesis, Department of Computer Science, Utrecht University, The Netherlands, 1989.Google Scholar
  32. 32.
    H. Vogt, S. D. Swierstra, and M. F. Kuiper. Higher-order attribute grammars. In Conference on Programming Languages Design and Implementation, pages 131–145, 1990. Published as ACM SIGPLAN Notices, 24(7).Google Scholar
  33. 33.
    Daniel Weise and Roger F. Crew. Programmable syntax macros. ACM SIGPLAN Notices, 28(6):156–165, 1993.CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2002

Authors and Affiliations

  • Eric Van Wyk
    • 1
  • Oege de Moor
    • 1
  • Kevin Backhouse
    • 1
  • Paul Kwiatkowski
    • 2
  1. 1.Computing LaboratoryOxford UniversityUK
  2. 2.Microsoft CorporationUSA

Personalised recommendations