The kennedy-warren algorithm revisited: ordering attribute grammars

  • Authors:
  • Jeroen Bransen;Arie Middelkoop;Atze Dijkstra;S. Doaitse Swierstra

  • Affiliations:
  • Utrecht University, The Netherlands;LIP6-Regal, The Netherlands;Utrecht University, The Netherlands;Utrecht University, The Netherlands

  • Venue:
  • PADL'12 Proceedings of the 14th international conference on Practical Aspects of Declarative Languages
  • Year:
  • 2012

Quantified Score

Hi-index 0.00

Visualization

Abstract

Attribute Grammars (AGs) are a powerful tool for defining an executable semantics of a programming language, and thus for implementing a compiler. An execution plan for an AG determines a static evaluation order for the attributes which are defined as part of an AG specification. In building the Utrecht Haskell Compiler (UHC), a large scale AG project, we discovered that the Ordered AG approach (Kastens, 1980) for building such plans becomes impractical: the additional dependencies between attributes introduced by this algorithm too often result in grammars for which no execution plan can be generated. To avoid such problems we have implemented a refined version of the algorithm of Kennedy and Warren (1976) as part of our purely functional AG system and show how this algorithm solves the problems that surface with the Ordered AG approach. Furthermore, we present the results of applying this algorithm to the UHC code and show that this approach in some cases also has a positive effect on the runtime of the resulting program.