arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 0710.5895cs.PLcs.LOcs.SE
收藏

基于抽象解释的Prolog程序源到源优化转换

Source-to-source optimizing transformations of Prolog programs based on abstract interpretation

Francois Gobert, Baudouin Le Charlier

摘要:

在不改变其操作语义的情况下,通过转换源代码使Prolog程序更有效,这不是一个显而易见的任务。它要求用户清楚地了解Prolog编译器是如何工作的,特别是不纯的特性(如cut)的影响。编写Prolog代码的方式-例如,从句的顺序、从句中字面意思的顺序、删减或否定的使用--都会影响其效率。此外,不同的优化技术在一起应用时可能是冗余的或冲突的,这取决于调用过程的方式-例如,插入切口并启用索引。我们提出了一个优化器,基于抽象的解释,自动执行安全的代码转换的Prolog程序的上下文中的一些类的输入调用。如果过程用关于模式、类型、共享、解决方案的数量等的附加信息来注释,则该方法更有效。因此,该方法与Mercury类似。它适用于任何Prolog程序。

英文摘要:

Making a Prolog program more efficient by transforming its source code, without changing its operational semantics, is not an obvious task. It requires the user to have a clear understanding of how the Prolog compiler works, and in particular, of the effects of impure features like the cut. The way a Prolog code is written - e.g., the order of clauses, the order of literals in a clause, the use of cuts or negations - influences its efficiency. Furthermore, different optimization techniques may be redundant or conflicting when they are applied together, depending on the way a procedure is called - e.g., inserting cuts and enabling indexing. We present an optimiser, based on abstract interpretation, that automatically performs safe code transformations of Prolog procedures in the context of some class of input calls. The method is more effective if procedures are annotated with additional information about modes, types, sharing, number of solutions and the like. Thus the approach is similar to Mercury. It applies to any Prolog program, however.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑