The right-hand side of a rule (no matter if modify or replace) can contain all sorts of statements, e.g. eval, exec, emit, subpatterns, ...
Is there a defined order in which these statements are executed or are they just executed in the order they appear in the right-hand side?
P.S.: GrGen.NET is a quite popular graph transformation library (check it out on http://grgen.net) based on the .NET-framework. It would be cool if someone could define a Tag for GrGen.NET, I don't have enough reputation :-). Cheers!
Yes, there is an order and it matters!
For example, the exec-statement always applies at the end. Hence, no variable from exec can be passed to the rule (cf. to How can I execute a script in a rule and pass a value back to a rule in booggie 2?).
The order of execution can be found in the manual of GrGen.NET and is as follows:
- Extract elements needed from match
- Create new nodes
- Call rewrite code of used subpatterns (and evalhere, emithere, alternative Name, iterated Name)
- Call rewrite code of nested iterateds
- Call rewrite code of nested alternatives
- Redirect edges
- Retype (and merge) nodes
- Create new edges
- Retype edges
- Create subpatterns
- Attribute reevaluation
- Remove edges
- Remove nodes
- Remove subpatterns
- Emit / Exec
- Return