Dynamic Rule
Stratego -- Strategies for Program Transformation
A dynamic rule is an ordinary
RewriteRule that is generated at run-time. A dynamic rule can inherit bindings of variables from its generation context. Dynamic rules solve the problem caused by the context-free nature of normal rewrite rules.
Syntax
A set of dynamic rules is introduced by the keyword
rules
as follows
rules(
Lab1 : l1 -> r1 where s1
...
Labn : ln -> rn where sn
)
This construct itself defines a
RewritingStrategy that can be applied. All variables that
are
statically bound before the
rules
construct is invoked are inherited by the dynamic
rules.
Resources
Dynamic rules are useful in many transformation problems.
Several examples of dynamic rules are presented in the paper
Scoped Dynamic Rewrite Rules.
The
dynamic rule semantics has undergone some changes over time. Hairy issues include overlapping left-hand sides in dynamic rules with the same label and the application of dynamic rules to terms with annotations.
Pragmatics
In order to use dynamic rules in a module it is necessary to import the module
dynamic-rules
.
Dynamic Rules Rethought
We're currently rethinking the concept of dynamic rules. Quite some changes are at stake. We maintain (some of) our thoughts at
DynamicRules Rethought.
--
EelcoVisser - 06 Dec 2001
--
EelcoVisser - 07 May 2002
--
ArthurVanDam - 25 Mar 2004