Rule [RuleName RuleBody] ‛«_.pushnewbindings ()»«_.bind ("RuleName", RuleName.rwr ())»’ = ‛\n«RuleName» = «RuleBody»«_.popbindings ()»’

1. rule name Rule

RWR text rewriter

2. rule parameters [RuleName RuleBody]

3. before bindings ‛«_.pushnewbindings ()»«_.bind ("RuleName", RuleName.rwr ())»’

4. syntactic noise =

5. rewrite string ‛\n«RuleName» = «RuleBody»«_.popbindings ()»’`

TODO

Rule [RuleName RuleBody] ‛«_.bind ("RuleName", RuleName.rwr ())»’ = ‛\n«RuleName» = «RuleBody»’

automatically (boilerplate) push fresh bindings on rule entry and pop bindings on rule exit

«...» syntax inserts value returned by sub-tree

all other characters copied to output “as is” (some characters can be escaped in customary manne)

example from actual code

not used for most rules

rewrite created AFTER sub-trees are walked

creates string as per (5.) BEFORE sub-trees are walked

should be easy, since trace feature of RWR already inserts _ruleEnter() and _ruleExit() into each semantic rule