## Generic type-preserving traversal strategies (2001)

Venue: | PROC. INTERNATIONAL WORKSHOP ON REDUCTION STRATEGIES IN REWRITING AND PROGRAMMING (WRS 2001), VOLUME SPUPV 2359 |

Citations: | 4 - 1 self |

### BibTeX

@INPROCEEDINGS{Lämmel01generictype-preserving,

author = {Ralf Lämmel},

title = {Generic type-preserving traversal strategies},

booktitle = {PROC. INTERNATIONAL WORKSHOP ON REDUCTION STRATEGIES IN REWRITING AND PROGRAMMING (WRS 2001), VOLUME SPUPV 2359},

year = {2001},

publisher = {}

}

### OpenURL

### Abstract

A typed model of strategic rewriting with coverage of generic traversals is developed. The corresponding calculus offers, for example, a strategy operator 2 (), which applies the argument strategy to all immediate subterms. To provide a typeful model for generic strategies, one has to identify signature-independent, that is, generic types. In the present article, we restrict ourselves to TP -- the generic type of all Type-Preserving strategies. TP is easily integrated into a standard many-sorted type system for rewriting. To inhabit TP, we need to introduce a (left-biased) type-driven choice operator & ,. The operator applies its left argument (corresponding to a many-sorted strategy) if the type of the given term ts, and the operator resorts to the right argument (corresponding to a generic default) otherwise. This approach dictates that the semantics of strategy application must be type-dependent to a certain extent.

### Citations

176 | PolyP — a polytypic programming language extension
- Jansson, Jeuring
- 1997
(Show Context)
Citation Context ...This problem is irrelevant for S 0 TP since types are statically enforced, and there is no universal (and hence imprecise) sort like any. The presented concepts were inspired by polytypic programming =-=[8,16]-=-. A polytypic function is de ned by induction on its argument type (with cases for sums, products, and others). Generic traversals in S 0 TP are performed in a somewhat similar manner. Generic travers... |

118 | Building program optimizers with rewriting strategies
- Visser, Benaissa, et al.
- 1998
(Show Context)
Citation Context ...ies are supported, for example, by the speci cation formalisms Maude [14,7] and ELAN [3,4]. Also, the -calculus [5] is very suitable for the de nition of strategies. The programming language Stratego =-=[20]-=- based on system S [21] isentirely devoted to strategic programming. The idea of rewriting strategies goes back toPaulson's work on higher-order implementation of rewriting strategies [18]. Strategies... |

109 | An Overview of ELAN
- Borovanský, Kirchner, et al.
- 1998
(Show Context)
Citation Context ...be strategies (as opposed to frameworks which assume a xed built-in strategy for normalisation/evaluation). Strategies are supported, for example, by the speci cation formalisms Maude [14,7] and ELAN =-=[3,4]-=-. Also, the -calculus [5] is very suitable for the de nition of strategies. The programming language Stratego [20] based on system S [21] isentirely devoted to strategic programming. The idea of rewri... |

97 | Dynamic typing in polymorphic languages
- Abadi, Cardelli, et al.
- 1995
(Show Context)
Citation Context ...amically updatable) generalised monadic folds for systems of datatypes [12]. There is no previous work on statically typed generic strategies in the narrow context of rewriting. In [4], dynamic types =-=[1]-=- are employed to cope with some generic (traversal) strategies in ELAN. A universal datatype any is used to represent terms of \any" sort. For that purpose, a parameterised module any[X] is o ered whi... |

53 | Types, abstraction, and parametric polymorphism, part 2
- Ma, Reynolds
- 1992
(Show Context)
Citation Context ...nhabit it in a trivial way. The scheme can only be inhabited by the identity function. Hence, the kind of polymorphism underlying generic traversals goes beyond parametric polymorphism. Parametricity =-=[22,15,13]-=- does not holds since generic traversals usually employ many-sorted ingredients (say rewrite rules) to deal with some distinguished sorts in a speci c manner. This form of genericity implies that the ... |

50 | A Higher-Order Implementation of Rewriting
- Paulson
- 1983
(Show Context)
Citation Context ...ge Stratego [20] based on system S [21] isentirely devoted to strategic programming. The idea of rewriting strategies goes back toPaulson's work on higher-order implementation of rewriting strategies =-=[18]-=-. Strategies are useful to describe evaluation and normalisation strategies, e.g., to control rewriting for some rewrite rules which are not con uent or terminating when considered as a standard rewri... |

46 | Rewriting with strategies in ELAN: A functional semantics
- Borovansky, Kirchner, et al.
(Show Context)
Citation Context ...be strategies (as opposed to frameworks which assume a xed built-in strategy for normalisation/evaluation). Strategies are supported, for example, by the speci cation formalisms Maude [14,7] and ELAN =-=[3,4]-=-. Also, the -calculus [5] is very suitable for the de nition of strategies. The programming language Stratego [20] based on system S [21] isentirely devoted to strategic programming. The idea of rewri... |

43 | Controlling rewriting by rewriting
- Borovansky, Kirchner, et al.
(Show Context)
Citation Context ...lus very much inspired by ELAN, the -calculus, and system S. We are very brief regarding explanations, examples, and details of the semantics. Some basic knowledge of strategic rewriting (as found in =-=[2,21,5]-=-) is a helpful background for reading the present article. First, we give an overview on the strategy combinators we want to cover, and we explain how to de ne new ones by means of strategy de nitions... |

41 | Calculate polytypically
- Meertens
- 1996
(Show Context)
Citation Context ...This problem is irrelevant for S 0 TP since types are statically enforced, and there is no universal (and hence imprecise) sort like any. The presented concepts were inspired by polytypic programming =-=[8,16]-=-. A polytypic function is de ned by induction on its argument type (with cases for sums, products, and others). Generic traversals in S 0 TP are performed in a somewhat similar manner. Generic travers... |

32 | The Rho Cube - Cirstea, Kirchner, et al. - 2001 |

30 |
The Maude system
- Clavel, Durán, et al.
- 1999
(Show Context)
Citation Context ... means to describe strategies (as opposed to frameworks which assume a xed built-in strategy for normalisation/evaluation). Strategies are supported, for example, by the speci cation formalisms Maude =-=[14,7]-=- and ELAN [3,4]. Also, the -calculus [5] is very suitable for the de nition of strategies. The programming language Stratego [20] based on system S [21] isentirely devoted to strategic programming. Th... |

28 | Dealing with Large Bananas
- Lammel, Visser, et al.
(Show Context)
Citation Context ...y to locate the desired node in the term is completely generic. The examples (III) and (IV) are examples of type-changing traversals, actually these are type-unifying traversals according 2sLammel to =-=[12,11]-=-. In (III), we might test some property of the term, e.g., if naturals occur at all. In (IV), we collect all the naturals in the term using a left-to-right traversal. Value of typing The contribution ... |

28 | A core language for rewriting
- Visser, Benaissa
- 1998
(Show Context)
Citation Context ...example, by the speci cation formalisms Maude [14,7] and ELAN [3,4]. Also, the -calculus [5] is very suitable for the de nition of strategies. The programming language Stratego [20] based on system S =-=[21]-=- isentirely devoted to strategic programming. The idea of rewriting strategies goes back toPaulson's work on higher-order implementation of rewriting strategies [18]. Strategies are useful to describe... |

27 | Language Independent Traversals for Program Transformation
- Visser
- 2000
(Show Context)
Citation Context ...to perform the actual traversal for the signature at hand (usually one rewrite rule per term constructor). Generic traversal primitives support an important dimension of genericity in programming. In =-=[19]-=-, for example, generic traversal strategies are used for language implementation: Algorithms for free variable collection, substitution, uni cation and others are de ned in a generic, that is, languag... |

13 | Type-safe functional strategies
- Lammel, Visser
- 2000
(Show Context)
Citation Context ...y to locate the desired node in the term is completely generic. The examples (III) and (IV) are examples of type-changing traversals, actually these are type-unifying traversals according 2sLammel to =-=[12,11]-=-. In (III), we might test some property of the term, e.g., if naturals occur at all. In (IV), we collect all the naturals in the term using a left-to-right traversal. Value of typing The contribution ... |

6 |
Introduction to the Rewriting Calculus. Rapport de recherche 3818
- Cirstea, Kirchner
- 1999
(Show Context)
Citation Context ...o frameworks which assume a xed built-in strategy for normalisation/evaluation). Strategies are supported, for example, by the speci cation formalisms Maude [14,7] and ELAN [3,4]. Also, the -calculus =-=[5]-=- is very suitable for the de nition of strategies. The programming language Stratego [20] based on system S [21] isentirely devoted to strategic programming. The idea of rewriting strategies goes back... |

3 |
The Genericity Theorem and the Notion of Parametricity
- Longo, Soloviev
- 1992
(Show Context)
Citation Context ...nhabit it in a trivial way. The scheme can only be inhabited by the identity function. Hence, the kind of polymorphism underlying generic traversals goes beyond parametric polymorphism. Parametricity =-=[22,15,13]-=- does not holds since generic traversals usually employ many-sorted ingredients (say rewrite rules) to deal with some distinguished sorts in a speci c manner. This form of genericity implies that the ... |

2 |
Typed Generic Traversals in S 0
- Lammel
- 2001
(Show Context)
Citation Context ...raversals as needed for the examples above. In the present article, we restrict ourselves to type-preserving strategies. A more exhaustive treatment including type-changing strategies can be found in =-=[10]-=-. Let us understand why types are valuable. In general, typing should obviously prevent us from constructing ill-typed terms. Generic traversals typically employ many-sorted ingredients (say rewrite r... |