Attribute Grammars as Recursion Schemes over Cyclic Representations of Zippers

  • Authors:
  • Eric Badouel;Bernard Fotsing;Rodrigue Tchougong

  • Affiliations:
  • INRIA Rennes - Bretagne Atlantique, Campus universitaire de Beaulieu, F-35402 Rennes, France;IRISA, Université de Rennes 1, Campus universitaire de Beaulieu, F-35402 Rennes, France;IRISA, Université de Rennes 1, Campus universitaire de Beaulieu, F-35402 Rennes, France

  • Venue:
  • Electronic Notes in Theoretical Computer Science (ENTCS)
  • Year:
  • 2011

Quantified Score

Hi-index 0.00

Visualization

Abstract

Evaluation of attributes w.r.t. an attribute grammar can be obtained by inductively computing a function expressing the dependencies of the synthesized attributes on inherited attributes. This higher-order functional approach to attribute grammars leads to a straightforward implementation using a higher-order lazy functional language like Haskell. The resulting evaluation functions are, however, not easily amenable to optimization rules. We present an alternative first-order functional interpretation of attribute grammars where the input tree is replaced with an extended cyclic tree each node of which is aware of its context viewed as an additional child tree. By the way, we demonstrate that these cyclic representations of zippers (trees with their context) are natural generalizations of doubly-linked lists to trees over an arbitrary signature.