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.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Deransart, P., M. Jourdan and B. Lorho. Attribute Grammars: Definitions, Systems and Bibliography. LNCS 323, Springer Verlag, Aug. 1988.
J. Craig Cleaveland and Robert C. Uzagalis Grammars for Programming Languages Elsevier/North-Holland 1977.
Ganzinger, H., and R. Giegerich. Attribute Coupled Grammars Sigplan Notices Vol. 19, No. 6, pages 157–170, 1984.
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.
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.
Hughes, R.J.M. Super-combinators: A New Implementation Method for Applicative Languages. In Proc. ACM Symp. on Lisp and Functional Progr., Pittsburgh, 1982.
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.
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.
Kastens, U. Ordered Attributed Grammars. Acta Informatica, 13, pages 229–256, 1980.
Knuth, D.E. Semantics of context-free languages. Math. Syst. Theory, 2(2):127–145, 1968.
Knuth, D.E. Semantics of context-free languages (correction). Math. Syst. Theory, 5(l):95–96, 1971.
Koster, C.H.A. Affix Grammars for Programming Languages this summer school
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.
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.
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.
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.
Reps, T. and T. Teitelbaum. The Synthesizer Generator: A System for Constructing Language-Based Editors. Springer-Verlag, NY, 1988.
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.
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.
Turner, D.A., A New Implementation Technique for Applicative Languages In Software, Practice and Experience, vol. 9, pages 31–49, 1979.
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.
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.
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.
Waite, W.M. and G.Goos. Compiler Construction. Springer, 1984.
Yeh, D. On incremental evaluation of ordered attributed grammars. BIT, 23:308–320, 1983.
Author information
Authors and Affiliations
Editor information
Rights 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