2008 · 40 citations · 25 references
ComputingComputer ScienceCompilersProgramming LanguagesSyntaxAbstract Syntax TreesData TypesData-flow AnalysisSyntactic AnalysisSyntax AnalysisType SystemsAbstract Syntax Tree RewritingBottom-up Rewrite SystemsGeneric FunctionsRewrite SystemsRewriting SystemsType-level Programming
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.
25
Koen Claessen, John Hughes · ACM SIGPLAN Notices · 2011 · 1K citations
Koen Claessen, John Hughes · 2000 · 714 citations
Template meta-programming for Haskell
Tim Sheard, Simon Peyton Jones · 2002 · 548 citations
Ralf Lämmel, Simon Peyton Jones · 2003 · 350 citations
Simple unification-based type inference for GADTs
Simon Peyton Jones, Dimitrios Vytiniotis, Stephanie Weirich et al. · 2006 · 336 citations