arXivDaily arXiv每日学术速递 周一至周五更新
arXiv cs/0208009cs.PLcs.AI
收藏

离线专业化的Prolog使用手写生成器

Offline Specialisation in Prolog Using a Hand-Written Compiler Generator

Michael Leuschel, Jesper Joergensen, Wim Vanhoof, Maurice Bruynooghe

摘要:

所谓的程序专门化的“cogen方法”,编写编译器生成器而不是专门化器,已经在函数式和命令式语言的部分评估中取得了相当大的成功。本文表明,cogen方法也适用于专业化的逻辑程序(也称为部分演绎),并导致有效的专业化。此外,使用良好的绑定时间注释,专业程序的速度提升与在线专业程序获得的速度提升相当。本文首先提出了一种一般的离线部分演绎方法,然后提出了一种特殊的离线部分演绎方法,从而得到了用于纯逻辑程序的离线系统LIX。虽然这本身是一个可用的专用程序,但它用于开发cogen系统LOGEN。给定一个程序,一个什么样的输入是静态的规范,以及一个指定哪些调用应该展开的注释,LOGEN为手头的程序生成一个专门的专门化程序。用静态输入的特定值运行这个专门化程序会产生专门化的程序。虽然这需要两个步骤而不是一个步骤,但在同一程序多次专业化的情况下,专业化过程的效率得到了提高。本文还提出了一种自动绑定时间分析,能够推导出的注释和评估。虽然与手工制作的注释相比,派生的注释仍然是次优的,但它们使非专家用户能够以完全自动化的方式使用LOGEN系统。最后,LOGEN被扩展,以便直接支持Prolog的声明性和非声明性功能的很大一部分,并能够执行所谓的混合行专门化。

英文摘要:

The so called ``cogen approach'' to program specialisation, writing a compiler generator instead of a specialiser, has been used with considerable success in partial evaluation of both functional and imperative languages. This paper demonstrates that the cogen approach is also applicable to the specialisation of logic programs (also called partial deduction) and leads to effective specialisers. Moreover, using good binding-time annotations, the speed-ups of the specialised programs are comparable to the speed-ups obtained with online specialisers. The paper first develops a generic approach to offline partial deduction and then a specific offline partial deduction method, leading to the offline system LIX for pure logic programs. While this is a usable specialiser by itself, it is used to develop the cogen system LOGEN. Given a program, a specification of what inputs will be static, and an annotation specifying which calls should be unfolded, LOGEN generates a specialised specialiser for the program at hand. Running this specialiser with particular values for the static inputs results in the specialised program. While this requires two steps instead of one, the efficiency of the specialisation process is improved in situations where the same program is specialised multiple times. The paper also presents and evaluates an automatic binding-time analysis that is able to derive the annotations. While the derived annotations are still suboptimal compared to hand-crafted ones, they enable non-expert users to use the LOGEN system in a fully automated way. Finally, LOGEN is extended so as to directly support a large part of Prolog's declarative and non-declarative features and so as to be able to perform so called mixline specialisations.

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

↑