GP 2 is a rule-based programming language based on graph transformation rules which aims to facilitate program analysis and verification. Writing efficient programs in such a language is challenging because graph matching is expensive. GP 2 addresses this problem by providing rooted rules which, under mild conditions, can be matched in constant time. Recently, we implemented a number of changes to Bak's GP 2-to-C compiler in order to speed up graph programs. One key improvement is a new data structure for dynamic arrays called BigArray. This is an array of pointers to arrays of entries, successively doubling in size. To demonstrate the speed-up achievable with the new implementation, we present a reduction program for recognising binary DAGs which previously ran in quadratic time but now runs in linear time when compiled with the new compiler.
翻译:GP 2 是一种基于图形转换规则的基于规则的编程语言,其目的是便利程序分析和核查。 以这种语言写入高效程序具有挑战性, 因为图形匹配费用昂贵。 GP 2 解决这个问题的方法是提供根扎不变的规则, 在温和的条件下, 在固定的时间里可以匹配。 最近, 我们对 Bak 的 GP 2 至 C 编译器进行了一些修改, 以加快图形程序。 一个关键的改进是, 名为 BigArray 的动态阵列的新数据结构。 这是一系列条目阵列的指针, 相继将大小翻倍。 为了显示在新执行中可以实现的加速速度, 我们为识别二进式 DAG 提出了一个削减程序, 之前在二次时间运行, 但现在与新编译器一起编译时, 会在线性时间运行 。