A Functional Semantics of Attribute Grammars

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.

[1]  Erik Poll,et al.  Algebra of Programming by Richard Bird and Oege de Moor, Prentice Hall, 1996 (dated 1997). , 1999 .

[2]  Eric Van Wyk,et al.  Forwarding in Attribute Grammars for Modular Language Design , 2002, CC.

[3]  Richard S. Bird Using circular programs to eliminate multiple traversals of data , 2004, Acta Informatica.

[4]  Richard S. Bird,et al.  Introduction to functional programming using haskeu , 1998 .

[5]  Philip Wadler,et al.  Theorems for free! , 1989, FPCA.

[6]  S. Doaitse Swierstra,et al.  First-class Attribute Grammars , 2000, Informatica.

[7]  Rodney Farrow Automatic generation of fixed-point-finding evaluators for circular, but well-defined, attribute grammars , 1986, SIGPLAN '86.

[8]  Patrick Cousot,et al.  Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints , 1977, POPL.

[9]  Simon Peyton Jones,et al.  The Implementation of Functional Programming Languages (Prentice-hall International Series in Computer Science) , 1987 .

[10]  Roland Carl Backhouse,et al.  Fixed-Point Calculus , 1995, Inf. Process. Lett..

[11]  Katsuhiko Gondow,et al.  Attribute Grammars as Record Calculus - A Structure-Oriented Denotational Semantics of Attribute Grammars by Using Cardelli's Record Calculus , 2000, Informatica.

[12]  Thomas Johnsson,et al.  Attribute grammars as a functional programming paradigm , 1987, FPCA.

[13]  Mads Rosendahl,et al.  Strictness Analysis for Attribute Grammars , 1992, PLILP.

[14]  Richard S. Bird,et al.  Algebra of programming , 1997, Prentice Hall International series in computer science.

[15]  Richard S. Bird,et al.  Introduction to functional programming , 1988, Prentice Hall International series in computer science.

[16]  S. D. Swierstra,et al.  Using attribute grammars to derive efficient functional programs , 1986 .

[17]  John C. Reynolds,et al.  Types, Abstraction and Parametric Polymorphism , 1983, IFIP Congress.

[18]  Simon L. Peyton Jones,et al.  The Implementation of Functional Programming Languages , 1987 .