Semantics-Directed Generation of a Prolog Compiler

Abstract In a recent paper [27], the denotational semantics for the language Prolog was presented. The aim was to define precisely the language. This paper goes further in this direction by describing how the denotational semantics of Prolog can be used to interpret and to compile Prolog programs, as well as to automatically generate a compiler for the language. Our approach is based on partial evaluation. Compilation is achieved by specializing the Prolog definition. The compiler is obtained by self-application of the partial evaluator. It is well-structured and the speed of the compiled code has been found to be about six times faster than interpretation. Our approach improves on previous work [14,22,32] in that: (i) it enables compiler generation and consequently speeds up the compilation process, and (ii) it goes beyond the usual mapping from syntax to denotations by processing the static semantics of the language definition.

[1]  Peter Lee,et al.  On the use of LISP in implementing denotational semantics , 1986, LFP '86.

[2]  Anders Bondorf,et al.  Automatic Autoprojection of Recursive Equations with Global Variables and Abstract Data Types , 1991, Sci. Comput. Program..

[3]  Raf Venken A Prolog Meta-Interpreter for Partial Evaluation and its Application to Source to Source Transformation and Query-Optimisation , 1984, ECAI.

[4]  Olivier Danvy,et al.  From Interpreting to Compiling Binding Times , 1990, ESOP.

[5]  Olivier Danvy,et al.  For a Better Support of Static Data Flow , 1991, FPCA.

[6]  William F. Clocksin,et al.  Programming in Prolog , 1981, Springer Berlin Heidelberg.

[7]  Neil D. Jones,et al.  Stepwise Development of Operational and Denotational Semantics for Prolog , 1984, International Conference on Spoken Language Processing.

[8]  Mitchell Wand A semantic prototyping system , 1984, SIGPLAN '84.

[9]  Charles Consel,et al.  A tour of Schism: a partial evaluation system for higher-order applicative languages , 1993, PEPM '93.

[10]  Neil D. Jones,et al.  Mix: A self-applicable partial evaluator for experiments in compiler generation , 1989, LISP Symb. Comput..

[11]  Charles Consel,et al.  Binding time analysis for high order untyped functional languages , 1990, LISP and Functional Programming.

[12]  Peter D. Mosses Compiler Generation Using Denotational Semantics , 1976, MFCS.

[13]  Peter Sestoft,et al.  An experiment in partial evaluation: the generation of a compiler generator , 1985, SIGP.

[14]  Charles Consel,et al.  New Insights into Partial Evaluation: the SCHISM Experiment , 1988, ESOP.

[15]  Anders Bondorf,et al.  Improving binding times without explicit CPS-conversion , 1992, LFP '92.

[16]  Henryk Jan Komorowski,et al.  A specification of an abstract Prolog machine and its application to partial evaluation , 1981 .

[17]  Olivier Danvy,et al.  Static and dynamic semantics processing , 1991, POPL '91.

[18]  David A. Schmidt,et al.  Denotationaisemantics: a methodology for language development , 1986 .

[19]  Saumya K. Debray,et al.  Denotational and Operational Semantics for Prolog , 1988, J. Log. Program..

[20]  Siau-Cheng Khoo,et al.  Semantics-Directed Generation of a Prolog Compiler , 1991, Sci. Comput. Program..

[21]  Mats Carlsson,et al.  The Compilation of Prolog Programs without the Use of a Prolog Compiler , 1984, Fifth Generation Computer Systems.

[22]  Norman Y. Foo,et al.  A denotational semantics for Prolog , 1989, ACM Trans. Program. Lang. Syst..

[23]  Jan Komorowski,et al.  Partial evaluation as a means for inferencing data structures in an applicative language: a theory and implementation in the case of prolog , 1982, POPL '82.

[24]  T G Muchnick,et al.  On some extensions of syntactic error recovery technique based on phrase markers , 1986, SIGP.

[25]  Anders Bondorf,et al.  Automatic Autoprojection of Higher Order Recursive Equations , 1990, Sci. Comput. Program..