GrGen.NET中规则的右边是如何执行的固定顺序? [英] Is there a fixed order of how the right-hand side of a rule is executed in GrGen.NET?

查看:181
本文介绍了GrGen.NET中规则的右边是如何执行的固定顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

规则的右侧(无论是修改还是替换)都可以包含各种各样的语句,例如eval,exec,emit,subpatterns,...

是否有这些语句被执行的定义顺序,或者它们是按照它们出现在右边的顺序执行的 - 手边?



PS:GrGen.NET是一个非常流行的图形转换库(在 http://grgen.net )基于.NET框架。如果有人能为GrGen.NET定义一个标签,那将是很酷的,我没有足够的声望:-)。干杯!

解决方案

是的,有一个命令,它很重要!

<例如,exec语句总是在最后应用。因此,exec中没有变量可以传递给规则(参见如何在规则中执行脚本并将值传回给booggie 2中的规则?)。



执行顺序可以在GrGen.NET手册中找到,如下所示:


$ b $ ol <
  • 从匹配中提取所需元素
  • 创建新节点
  • 调用重写
  • 调用嵌套迭代的重写代码

  • 调用嵌套替换的重写代码

  • 重定向边

  • 重新键入(和合并)节点

  • 创建新边
  • 重新定义边

  • 创建子模式

  • 重新定义属性
  • 移除边

  • 删除节点

  • 删除子模式

  • 发送/执行

  • li>


    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:

    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

    这篇关于GrGen.NET中规则的右边是如何执行的固定顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆