Skip to search boxSkip to navigationSkip 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 chapter
Book chapter
Peer-review

Open access

Publication Information

Output type

Research Output:
Conference Article in Proceeding or Book/Report chapter
Book chapter
Peer-review

Original language

English

Pages from-to (Number of pages)

Pages 27-38 (12 pages)

Publication milestones

  • Published - 01/01/2015

Publication status

Published - 01/01/2015

Place of publication

New York, NY, USA

Publisher

Association for Computing Machinery, United States
978-1-4503-3297-2

Publication IDs

  • Scopus: 84967225649

Host publication title

Proceedings of the 2015 Workshop on Partial Evaluation and Program Manipulation

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.

Publication metrics

PlumX, opens in new tab

Captures
14
Citations
2