1,164 research outputs found

    A π-Calculus Specification of Prolog

    Get PDF
    A clear and modular specification of Prolog using the π-calculus is presented in this paper. Prolog goals are represented as π-calculus processes, and Prolog predicate definitions are translated into π-calculus agent definitions. Prolog\u27s depth-first left-right control strategy as well as the cut control operator are modeled by the synchronized communication among processes, which is similar in spirit to continuation-passing style implementation of Prolog. Prolog terms are represented by persistent processes, while logical variables are modeled by complex processes with channels that, at various times, can be written, read, and reset. Both unifications with and without backtracking are specified by π-calculus agent definitions. A smooth merging of the specification for control and the specification for unification gives a full specification for much of Prolog. Some related and further works are also discussed

    Delimited continuations for Prolog

    Get PDF
    Delimited continuations are a famous control primitive that originates in the functional programming world. It allows the programmer to suspend and capture the remaining part of a computation in order to resume it later. We put a new Prolog-compatible face on this primitive and specify its semantics by means of a meta-interpreter. Moreover, we establish the power of delimited continuations in Prolog with several example definitions of high-level language features. Finally, we show how to easily and effectively add delimited continuations support to the WAM

    Description and Optimization of Abstract Machines in a Dialect of Prolog

    Full text link
    In order to achieve competitive performance, abstract machines for Prolog and related languages end up being large and intricate, and incorporate sophisticated optimizations, both at the design and at the implementation levels. At the same time, efficiency considerations make it necessary to use low-level languages in their implementation. This makes them laborious to code, optimize, and, especially, maintain and extend. Writing the abstract machine (and ancillary code) in a higher-level language can help tame this inherent complexity. We show how the semantics of most basic components of an efficient virtual machine for Prolog can be described using (a variant of) Prolog. These descriptions are then compiled to C and assembled to build a complete bytecode emulator. Thanks to the high level of the language used and its closeness to Prolog, the abstract machine description can be manipulated using standard Prolog compilation and optimization techniques with relative ease. We also show how, by applying program transformations selectively, we obtain abstract machine implementations whose performance can match and even exceed that of state-of-the-art, highly-tuned, hand-crafted emulators.Comment: 56 pages, 46 figures, 5 tables, To appear in Theory and Practice of Logic Programming (TPLP
    • …
    corecore