|
ABSTRACT
Previous implementations of generic rewriting libraries have a number of limitations: they require the user to either adapt the datatype on which rewriting is applied, or the rewriting rules are specified as functions, which makes it hard or impossible to document, test, and analyse them. We describe a library that demonstrates how to overcome these limitations by defining rules in terms of datatypes, and show how to use a type-indexed datatype to automatically extend a datatype for syntax trees with a case for metavariables. We then show how rewrite rules can be implemented without any knowledge of how the datatype is extended with metavariables. We use Haskell, extended with associated type synonyms, to implement both type-indexed datatypes and generic functions. We analyse the performance of our library and compare it with other approaches to generic rewriting.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
Artem Alimarine and Sjaak Smetsers. Improved fusion for optimizing generics. In Manuel V. Hermenegildo and Daniel Cabeza, editors, Practical Aspects of Declarative Languages, 7th International Symposium, PADL 2005, Long Beach, CA, USA, January 10-11, 2005, Proceedings, volume 3350 of Lecture Notes in Computer Science, pages 203--218. Springer-Verlag, 2005.
|
| |
2
|
Peter Borovanský, Claude Kirchner, Hélèene Kirchner, and Christophe Ringeissen. Rewriting with strategies in ELAN: A functional semantics. International Journal of Foundations of Computer Science, 12(1): 69--95, 2001.
|
 |
3
|
|
| |
4
|
Neil C. C. Brown and Adam T. Sampson. Matching and modifying with generics. In Peter Achten, Pieter Koopman, and Marco T. Morazán, editors, Draft Proceedings of the Ninth Symposium on Trends in Functional Programming (TFP), May 26-28 2008, Center Parcs 'Het Heijderbos', The Netherlands, pages 304--318, 2008. The draft proceedings of the symposium have been published as a technical report (ICIS-R08007) at Radboud University Nijmegen.
|
 |
5
|
|
| |
6
|
Manuel M. T. Chakravarty, Gabriele Keller, Roman Leshchinskiy, and Simon Peyton Jones. Generic programming with type families, 2008. Work in progress.
|
 |
7
|
|
 |
8
|
|
| |
9
|
|
| |
10
|
Bastiaan Heeren , Johan Jeuring , Arthur Leeuwen , Alex Gerdes, Specifying Strategies for Exercises, Proceedings of the 9th AISC international conference, the 15th Calculemas symposium, and the 7th international MKM conference on Intelligent Computer Mathematics, July 28-August 01, 2008, Birmingham, UK
[doi> 10.1007/978-3-540-85110-3_36]
|
| |
11
|
|
| |
12
|
Stefan Holdermans, Johan Jeuring, Andres Löh, and Alexey Rodriguez. Generic views on data types. In Tarmo Uustalu, editor, Mathemathics of Program Construction, 8th International Conference, MPC 2006, Kuressaare, Estonia, July 3-5, 2006, Proceedings, volume 4014 of Lecture Notes in Computer Science, pages 209--234. Springer-Verlag, 2006.
|
| |
13
|
|
| |
14
|
Patrik Jansson and Johan Jeuring. A framework for polytypic programming on terms, with an application to rewriting. In Johan Jeuring, editor, Proceedings Workshop on Generic Programming (WGP2000), July 6, 2000, Ponte de Lima, Portugal, pages 33--45, 2000. The proceedings of the workshop have been published as a technical report (UU-CS-2000-19) at Utrecht University.
|
 |
15
|
|
| |
16
|
|
 |
17
|
|
| |
18
|
|
 |
19
|
|
| |
20
|
Thomas van Noort. Generic views for generic types. Master's thesis, Utrecht University, 2008.
|
| |
21
|
Ulf Norell and Patrik Jansson. Polytypic programming in Haskell. In Philip W. Trinder, Greg Michaelson, and Ricardo Pena, editors, Implementation of Programming Languages, 15th International Workshop, IFL 2003, Edinburgh, UK, September 8-11, 2003, Revised Papers, volume 3145 of Lecture Notes in Computer Science, pages 168--184. Springer-Verlag, 2004.
|
 |
22
|
|
| |
23
|
Alexey Rodriguez, Stefan Holdermans, Andres Löh, and Johan Jeuring. Generic programming with fixed points for mutually recursive datatypes. Technical Report UU-CS-2008-019, Utrecht University, 2008.
|
 |
24
|
|
 |
25
|
|
|