Skip to main content

Higher Order Attribute Grammars

  • Conference paper
  • First Online:
Attribute Grammars, Applications and Systems (SAGA School 1991)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 545))

  • 1651 Accesses

Abstract

Higher Order Attribute Grammars (HAGs) are an extension of normal attribute grammars in the sense that the distinction between the domain of parse-trees and the domain of attributes has disappeared: parse trees may be computed in attributes and grafted to the parse tree at various places. As a result semantic functions may be described by attribute evaluation.

We will present the basic definitions for HAGs, and compare them with attribute coupled grammars, extended affix grammars and functional programming languages. We will indicate how multi-pass compilers and a compiler for supercombinators can be described this way.

It will be shown that, especially in the case of incremental evaluation, the conventional execution model has to be generalised. Such a model, based on function caching, hash-consing and combinator construction will be discussed. This model encompasses many of the more ad-hoc optimisations one finds in standard implementations of normal attribute grammars.

Support has been received from the Netherlands Organisation for Scientific Research N.W.O. under NFI-project STOP, project Specification and Transformations Of Programs.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Similar content being viewed by others

References

  1. Deransart, P., M. Jourdan and B. Lorho. Attribute Grammars: Definitions, Systems and Bibliography. LNCS 323, Springer Verlag, Aug. 1988.

    Google Scholar 

  2. J. Craig Cleaveland and Robert C. Uzagalis Grammars for Programming Languages Elsevier/North-Holland 1977.

    Google Scholar 

  3. Ganzinger, H., and R. Giegerich. Attribute Coupled Grammars Sigplan Notices Vol. 19, No. 6, pages 157–170, 1984.

    Article  Google Scholar 

  4. Deransart, P., M. Jourdan (Eds.). Attribute Grammars and their Applications. Proceedings of the International Workshop on Attribute Grammars and their Applications (WAGA), LNCS 461, Paris, September 19–21, 1990.

    Google Scholar 

  5. Hoover, R. Dynamically Bypassing Copy Rule Chains in Attribute Grammars. In Proc. of the 13th ACM Symp. on Principles of Programming Languages, St. Petersburg, FL, Jan 13–15, pages 14–25, 1986.

    Google Scholar 

  6. Hughes, R.J.M. Super-combinators: A New Implementation Method for Applicative Languages. In Proc. ACM Symp. on Lisp and Functional Progr., Pittsburgh, 1982.

    Google Scholar 

  7. Hughes, R.J.M. Lazy memo functions. In Proc. Conference on Functional Progr. and Comp. Architecture, Nancy, pages 129–146, LNCS 201, Springer Verlag, 1985.

    Google Scholar 

  8. Jazayeri, M., W.F. Ogden, W.C. Rounds. The intrinsically exponential complexity of the circularity problem for attributed grammars. In CACM 18, pages 679–706, 1975.

    Google Scholar 

  9. Kastens, U. Ordered Attributed Grammars. Acta Informatica, 13, pages 229–256, 1980.

    Article  Google Scholar 

  10. Knuth, D.E. Semantics of context-free languages. Math. Syst. Theory, 2(2):127–145, 1968.

    Article  Google Scholar 

  11. Knuth, D.E. Semantics of context-free languages (correction). Math. Syst. Theory, 5(l):95–96, 1971.

    Article  Google Scholar 

  12. Koster, C.H.A. Affix Grammars for Programming Languages this summer school

    Google Scholar 

  13. Swierstra 87] Kuiper, M.F. and S.D. Swierstra Using Attribute Grammars to Derive Efficient functional programs. Computing Science in the Netherlands, SION, November 1987.

    Google Scholar 

  14. Pugh, W.W. Incremental Computation and the Incremental Evaluation of Functional Programs. Tech. Rep. 88–936 and Ph.D. Thesis, Dept. of Computer Science, Cornell Univ., Ithaca, N.Y., Aug. 1988.

    Google Scholar 

  15. Reps, T. Generating language based environments. Tech. Rep. 82–514 and Ph.D dissertation, Dept. of Computer Science, Cornell Univ., Ithaca, N.Y., Aug. 1982.

    Google Scholar 

  16. Reps, T., T. Teitelbaum and A. Demers. Incremental Context-Dependent Analysis for Language Based Editors. In ACM Transactions on Progr. Lang. and Systems, Vol. 5, No. 3, pages 449–477, July 1983.

    Article  Google Scholar 

  17. Reps, T. and T. Teitelbaum. The Synthesizer Generator: A System for Constructing Language-Based Editors. Springer-Verlag, NY, 1988.

    Google Scholar 

  18. Teitelbaum, T. and R. Chapman. Higher-Order Attribute Grammars and Editing Environments. ACM SIGPLAN '90 Conference on Programming Language Design and Implementation, White Plains, New York, pages 197–208, June, 1990.

    Google Scholar 

  19. Turner, D.A. Miranda: A non-strict functional language with polymorphic types. In J. Jouannaud, editor, Funct. Progr. Lang. and Comp. Arch., pages 1–16, Springer, 1985.

    Google Scholar 

  20. Turner, D.A., A New Implementation Technique for Applicative Languages In Software, Practice and Experience, vol. 9, pages 31–49, 1979.

    Google Scholar 

  21. Vogt, H.H., S.D. Swierstra and M.F. Kuiper. Higher Order Attribute Grammars. ACM SIGPLAN '89 Conference on Programming Language Design and Implementation, Portland, Oregon, pages 131–145, June, 1989.

    Google Scholar 

  22. Vogt, H.H., A. van den Berg and A. Freije. Rapid development of a program transformation system with attribute grammars and dynamic transformations. In the proceedings of the International Workshop on Attribute Grammars and their Applications (WAGA), LNCS 461, Paris, pages 101–115, September 19–21, 1990.

    Google Scholar 

  23. Vogt, H.H., S.D. Swierstra and M.F. Kuiper. Efficient incremental evaluation of higher order attribute grammars. In the proceedings of the International Symposium on Programming Language Implementation and Logic Programming, Passau (FRG), August 26–28, (To Appear), 1991.

    Google Scholar 

  24. Waite, W.M. and G.Goos. Compiler Construction. Springer, 1984.

    Google Scholar 

  25. Yeh, D. On incremental evaluation of ordered attributed grammars. BIT, 23:308–320, 1983.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Henk Alblas Bořivoj Melichar

Rights and permissions

Reprints and permissions

Copyright information

© 1991 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Swierstra, D., Vogt, H. (1991). Higher Order Attribute Grammars. In: Alblas, H., Melichar, B. (eds) Attribute Grammars, Applications and Systems. SAGA School 1991. Lecture Notes in Computer Science, vol 545. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-54572-7_10

Download citation

  • DOI: https://doi.org/10.1007/3-540-54572-7_10

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-54572-9

  • Online ISBN: 978-3-540-38490-8

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics