[关键词]
[摘要]
部分计算是一种重要的程序变换方法和编译优化技术,Prolog程序特别适合于部分计算。目前,国际上已开始了几个Prolog程序部分计算的原理模型和专用工具,但其中存在以下若于问题:(1)关于Prolog程序部分计算的基本原理和特征缺乏系统的认识;(2)现有的两种检测逻辑程序中循环的方法,并没有最后解决部分计算的终止性问题》;(3)关于Prolog中内部谓词的处理不够究善,而且其中还隐含了许多语叉错误;(4)部分计算算法相当低效;(5)现有的部分计算器局限于各自的应用领域,缺乏通用性。本文结合我们研制GKD-Prolog编译系统[14]剖中一个实用源级部分计算器的工作实践,全面、系统地讨论了纯Prolog的部分计算、逻辑程序的循环检测以及全Prolog的内部谓词处理。
[Key word]
[Abstract]
Partial evaluation is an important program transformation method and compiling optimisation technique.Prolog programs are specially suited to be partially evaluated.At present,several principl models and special-purpose tools of the partial evaluation of Prolog programs have been developed in the world,but there are still following problkems in these works;(1)There us lack of systematic understanding for the basic principle and characteristics of the partial evaluation of Prolog programs;(2)Both methods which are used to detect loops in logic programs don't bring the termination prob;em in partial evaluation to a final solution;(3)The treatment of builtins in Prolog is imperfect and there are many implicit semantic errors in it;(4)The efficiency of some algorithms for partial evaluation is very low;(5)The partial eval uators now available are confined to their application fields,respoctively,and they are lack of generality.Based on our working practice in researching and developing a practical sourec-lecel partial evaluator in GKD-Prolog compiler[14],this paper discusses the partial evaluation of programs in pure Prolog,the detection of loops in logic programs and the treatment of builtins in full Prolog entirely and systematically.
[中图分类号]
[基金项目]