Question

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!

Was it helpful?

Solution

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:

  1. Extract elements needed from match
  2. Create new nodes
  3. Call rewrite code of used subpatterns (and evalhere, emithere, alternative Name, iterated Name)
  4. Call rewrite code of nested iterateds
  5. Call rewrite code of nested alternatives
  6. Redirect edges
  7. Retype (and merge) nodes
  8. Create new edges
  9. Retype edges
  10. Create subpatterns
  11. Attribute reevaluation
  12. Remove edges
  13. Remove nodes
  14. Remove subpatterns
  15. Emit / Exec
  16. Return
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top