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

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

rewrite created AFTER sub-trees are walked

not used for most rules

example from actual code

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

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

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

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

TODO

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

4. syntactic noise =

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

2. rule parameters [RuleName RuleBody]

RWR text rewriter

1. rule name Rule

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