The Kennedy-Warren algorithm revisited: ordering Attribute Grammars

J. Bransen, A. Middelkoop, A. Dijkstra, S.D. Swierstra

    Research output: Chapter in Book/Report/Conference proceedingConference contributionAcademicpeer-review

    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.
    Original languageEnglish
    Title of host publicationPractical Aspects of Declarative Languages
    EditorsC. Russo, N.-F. Zhou
    PublisherSpringer
    Pages183-197
    Number of pages15
    DOIs
    Publication statusPublished - 23 Jan 2012

    Fingerprint

    Dive into the research topics of 'The Kennedy-Warren algorithm revisited: ordering Attribute Grammars'. Together they form a unique fingerprint.

    Cite this