Skip to main navigation Skip to search Skip to main content

Generalising Tree Traversals to DAGs: Exploiting Sharing without the Pain

    • University of Copenhagen

    Research output: Conference Article in Proceeding or Book/Report chapterBook chapterResearchpeer-review

    Abstract

    We present a recursion scheme based on attribute grammars that can be transparently applied to trees and acyclic graphs. Our recursion scheme allows the programmer to implement a tree traversal and then apply it to compact graph representations of trees instead. The resulting graph traversals avoid recomputation of intermediate results for shared nodes -- even if intermediate results are used in different contexts. Consequently, this approach leads to asymptotic speedup proportional to the compression provided by the graph representation. In general, however, this sharing of intermediate results is not sound. Therefore, we complement our implementation of the recursion scheme with a number of correspondence theorems that ensure soundness for various classes of traversals. We illustrate the practical applicability of the implementation as well as the complementing theory with a number of examples.
    Original languageEnglish
    Title of host publicationProceedings of the 2015 Workshop on Partial Evaluation and Program Manipulation
    Number of pages12
    Place of PublicationNew York, NY, USA
    PublisherAssociation for Computing Machinery
    Publication date1 Jan 2015
    Pages27-38
    ISBN (Print)978-1-4503-3297-2
    DOIs
    Publication statusPublished - 1 Jan 2015

    Keywords

    • attribute grammar, tree automata, graph automata, sharing, rewriting, EDSLs, graph traversals

    Fingerprint

    Dive into the research topics of 'Generalising Tree Traversals to DAGs: Exploiting Sharing without the Pain'. Together they form a unique fingerprint.

    Cite this