A continuation-passing style for prolog
Thomas Lindgren · 1994
We propose a translation of Prolog (including cut, if-then-else and similar constructs) into a first-order continuation-passing style, where (almost) all predicates have one clause and all clauses are binary. The resulting programs can be used as a flexible intermediate representation for compilation with a number of advantages as compared to Warren's abstract machine and other proposals. We discuss the advantages and disadvantages of this approach. A Continuation-Passing Style for Prolog Thomas Lindgren Computing Science Department, Uppsala University Box 311 751 05 Uppsala e-mail: [email protected] 1 Introduction The purpose of this paper is to define an intermediate representation for the compilation of Prolog and related languages. Previous research in the functional language community has shown that the continuationpassing style (CPS) may express the control of a computation much in the same way as control flow graphs do in imperative languages. This is promising for advanced...