Abstract
A definition of the semantics of attribute grammars is given, using the lambda calculus.We show how this semantics allows us to prove results about attribute grammars in a calculational style. In particular, we give a new proof of Chirica and Martin’s result [6], that the attribute values can be computed by a structural recursion over the tree. We also derive a new definedness test, which encompasses the traditional closure and circularity tests. The test is derived by abstract interpretation.
Chapter PDF
Similar content being viewed by others
References
C. J. Aarts. Galois connections presented calculationally. Graduating Dissertation, Department of Computing Science, Eindhoven University of Technology. Available from: http://www.cs.nott.ac.uk/char’176rcb/MPC/galois.ps.gz, 1992.
R. C. Backhouse and K. S. Backhouse. Abstract interpretations for free. Available from: http://www.cs.nott.ac.uk/char’176rcb/papers/papers.html.
R. S. Bird. Using circular programs to eliminate multiple traversals of data. Acta Informatica, 21:239–250, 1984.
R. S. Bird. Introduction to Functional Programming using Haskell. Prentice Hall, 2 edition, 1998.
R. S. Bird and O. de Moor. Algebra of Programming, volume 100 of International Series in Computer Science. Prentice Hall, 1997.
L. M. Chirica and D. F. Martin. An order-algebraic definition of Knuthian semantics. Mathematical Systems Theory, 13(1):1–27, 1979.
P. Cousot and R. Cousot. Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Conference Record of the Fourth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 238–252, Los Angeles, California, 1977. ACM Press, New York, NY.
O. de Moor, K. Backhouse, and S. D. Swierstra. First-class attribute grammars. Informatica, 24(3):329–341, 2000.
R. Farrow. Automatic generation of fixed-point-finding evaluators for circular, but well-defined, attribute grammars. In SIGPlan’ 86 Symposium on Compiler Construction, pages 85–98, Palo Alto, CA, June 1986. Association for Computing Machinery, SIGPlan.
K. Gondow and T. Katayama. Attribute grammars as record calculus—a structure-oriented denotational semantics of attribute grammars by using cardelli’s record calculus. Informatica, 24(3):287–299, 2000.
T. Johnsson. Attribute grammars as a functional programming paradigm. In Gilles Kahn, editor, Proceedings of the Conference on Functional Programming Languages and Computer Architecture, volume 274 of LNCS, pages 154–173, Portland, OR, September 1987. Springer-Verlag.
D. E. Knuth. Semantics of context-free languages. Mathematical Systems Theory, 2:127–146, 1968.
D. E. Knuth. Semantics of context-free languages: Correction. Mathematical Systems Theory, 5:95–96, 1971.
M. Kuiper and S. D. Swierstra. Using attribute grammars to derive efficient functional programs. In Computing Science in the Netherlands CSN’ 87, 1987.
Mathematics of Program Construction Group, Eindhoven University of Technology. Fixed-point calculus. Information Processing Letters Special Issue on The Calculational Method, 53:131–136, 1995.
S. L. Peyton Jones. The Implementation of Functional Programming Languages. Series in Computer Science. Prentice Hall, 1987.
J. C. Reynolds. Types, abstraction and parametric polymorphism. In R. E. A. Mason, editor, Proceedings 9th IFIP World Computer Congress, Information Processing’ 83, Paris, France, 19–23 Sept 1983, pages 513–523. North-Holland, Amsterdam, 1983.
M. Rosendahl. Strictness analysis for attribute grammars. In PLILP’92, volume 631 of LNCS, pages 145–157. Springer-Verlag, 1992.
E. Van Wyk, O. de Moor, K. Backhouse, and P. Kwiatkowski. Forwarding in attribute grammars for modular language design. Compiler Construction 2002.
P. Wadler. Theorems for free! In FPCA’89, London, England, pages 347–359. ACM Press, September 1989.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2002 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Backhouse, K. (2002). A Functional Semantics of Attribute Grammars. In: Katoen, JP., Stevens, P. (eds) Tools and Algorithms for the Construction and Analysis of Systems. TACAS 2002. Lecture Notes in Computer Science, vol 2280. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-46002-0_11
Download citation
DOI: https://doi.org/10.1007/3-540-46002-0_11
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-43419-1
Online ISBN: 978-3-540-46002-2
eBook Packages: Springer Book Archive