KURE
From HaskellWiki
m 

(One intermediate revision by one user not shown)  
Line 3:  Line 3:  
[[Category:Combinators]] 
[[Category:Combinators]] 

−  KURE (pronounced cure) is a DSL for writing rewrite systems over grammars with scope. It was used (along with Template Haskell) to provide the basic rewrite abilities inside [[Hera HERA]]. It has been recently rewritten and will be published on hackage shortly. KURE provides combinators for ordering the application of an abstract type, Rewrite, combinators for building primitive rewrites, and combinators performing rewrite searches. KURE will be used to power the next version of [[Hera HERA]]. 
+  KURE (pronounced cure) is a Haskell hosted Domain Specific Language (DSL) for writing transformation systems based on rewrite strategies. When writing transformation systems, a significant amount of engineering effort goes into setting up plumbing to make sure that specific rewrite rules can fire. Systems like Stratego and Strafunski provide most of this plumbing as infrastructure, allowing the DSL user to focus on the rewrites rules. KURE is a strongly typed strategy control language in the tradition of Stratego and Strafunski. It is intended for writing reasonably efficient rewrite systems, makes use of type families to provide a delimited generic mechanism for tree rewriting, and provides support for efficient identity rewrite detection. 
−  == Basic Combinators == 
+  KURE was used (along with Template Haskell) to provide the basic rewrite abilities inside [[Hera HERA]]. It was rewritten in late 2008, and is published on hackage. KURE will be used to power the next version of [[Hera HERA]], 
+  due for released at some point in 2009. 

−  Simplified, the basic type is Rewrite 
+  Further details can be found at the webpage 
−  +  http://www.ittc.ku.edu/~andygill/kure.php. 

−  <hask> 

−  data Rewrite exp = ... 

−  </hask> 

−  
−  with methods to help order Rewrites. 

−  
−  <hask> 

−   do the first rewrite, and the second. 

−  (>+>) :: Rewrite exp > Rewrite exp > Rewrite exp 

−   do the first rewrite, then second iff the first changed something. 

−  (>&>) :: Rewrite exp > Rewrite exp > Rewrite exp 

−   do the first rewrite, then second iff the first did not change anything. 

−  (>>) :: Rewrite exp > Rewrite exp > Rewrite exp 

−   id rewrite, does not change anything. 

−  nullRewrite :: Rewrite exp 

−   repeat the application of rewrites until no more are possible. 

−  many :: Rewrite exp > Rewrite exp 

−  </hask> 

−  
−  None of these methods can actually choose based on the internals of the expression, so we have a combinator that can choose. 

−  
−  <hask> 

−  choose :: (exp > Rewrite exp) > Rewrite exp 

−  </hask> 

−  
−  Because Rewrite is abstract, we can only <b>look</b> at exp, can choose what to apply, not actually use the exp argument in our result. 

−  
−  == Primitive Rewrites == 

−  
−  There are also ways of providing primitives, promoting a monadic rewrite into an abstract Rewrite. 

−  
−  <hask> 

−  data RewriteM exp = ... 

−  rewrite :: (exp > RewriteM exp) > Rewrite exp 

−  </hask> 

−  
−  and a method for promoting a Rewrite into a RewriteM rewrite, allowing the authorship of abstraction breaking primitives in terms of other abstract rewrites, if required. 

−  
−  <hask> 

−  apply :: Rewrite exp > exp > RewriteM exp 

−  </hask> 

−  
−  == Searching == 

−  
−  The library also provides ways of searching for places to applying rewrite rules inside syntax trees, allowing KURE to be used as a nanopass engine for compilation or optimization. Rewrites (or combinations of rewrites) can be applied in a prefix or postfix order. 
Latest revision as of 16:06, 29 December 2008
KURE (pronounced cure) is a Haskell hosted Domain Specific Language (DSL) for writing transformation systems based on rewrite strategies. When writing transformation systems, a significant amount of engineering effort goes into setting up plumbing to make sure that specific rewrite rules can fire. Systems like Stratego and Strafunski provide most of this plumbing as infrastructure, allowing the DSL user to focus on the rewrites rules. KURE is a strongly typed strategy control language in the tradition of Stratego and Strafunski. It is intended for writing reasonably efficient rewrite systems, makes use of type families to provide a delimited generic mechanism for tree rewriting, and provides support for efficient identity rewrite detection.
KURE was used (along with Template Haskell) to provide the basic rewrite abilities inside HERA. It was rewritten in late 2008, and is published on hackage. KURE will be used to power the next version of HERA, due for released at some point in 2009.
Further details can be found at the webpage http://www.ittc.ku.edu/~andygill/kure.php.