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