Term Rewriting with Type-safe Traversal Functions
ثبت نشده
چکیده
Term rewriting is an appealing technique for performing program analysis and program transformation. Tree (term) traversal is frequently used but is not supported by standard term rewriting. In this paper, many-sorted rst-order term rewriting is extended with automatic tree traversal by adding two primitive tree traversal strategies and complementing them with three types of traversals. These so-called traversal functions can be either top-down or bottom-up. They can be sort preserving, mapping to a single sort, or a combination of these two. Traversal functions have a simple design, their application is type-safe in a rst-order many-sorted setting and can be implemented eÆciently. We describe the operational semantics of traversal functions and discuss applications.
منابع مشابه
ar X iv : c s / 02 05 01 8 v 1 [ cs . P L ] 1 4 M ay 2 00 2 Typed Generic Traversal With Term Rewriting Strategies
A typed model of strategic term rewriting is developed. The key innovation is that generic traversal is covered. To this end, we define a typed rewriting calculus S γ . The calculus employs a many-sorted type system extended by designated generic strategy types γ. We consider two generic strategy types, namely the types of type-preserving and type-unifying strategies. S γ offers traversal combi...
متن کاملTyped generic traversal with term rewriting strategies
A typed model of strategic term rewriting is developed. The key innovation is that generic traversal is covered. To this end, we define a typed rewriting calculus S γ . The calculus employs a many-sorted type system extended by designated generic strategy types γ. We consider two generic strategy types, namely the types of type-preserving and type-unifying strategies. S γ offers traversal combi...
متن کاملWRS 2002 - accepted papers
s of papers accepted for presentation The Sketch of a Polymorphic Symphony Ralf Laemmel Functional strategies were previously defined as first-class generic functions which can traverse into terms while mixing uniform and type-specific behaviour. The first-class status is witnessed by a combinator style of generic programming. This symphony reconstructs functional strategies as an amalgamation ...
متن کاملAlgebraic Specialization of Generic Functions for Recursive Types
Defining functions over large, possibly recursive, data structures usually involves a lot of boilerplate. This code simply traverses non-interesting parts of the data, and rapidly becomes a maintainability problem. Many generic programming libraries have been proposed to address this issue. Most of them allow the user to specify the behavior just for the interesting bits of the structure, and p...
متن کامل