Hostname: page-component-76d6cb85b7-rxvq6 Total loading time: 0 Render date: 2026-07-10T17:18:38.677Z Has data issue: false hasContentIssue false

Disjunctive Delimited Control

Published online by Cambridge University Press:  11 April 2023

ALEXANDER VANDENBROUCKE
Affiliation:
Standard Chartered, London, UK
TOM SCHRIJVERS
Affiliation:
KU Leuven, Leuven, Belgium
Rights & Permissions [Opens in a new window]

Abstract

Delimited control is a powerful mechanism for programming language extension which has been recently proposed for Prolog (and implemented in SWI-Prolog). By manipulating the control flow of a program from inside the language, it enables the implementation of powerful features, such as tabling, without modifying the internals of the Prolog engine. However, its current formulation is inadequate: it does not capture Prolog’s unique non-deterministic nature which allows multiple ways to satisfy a goal.

This paper fully embraces Prolog’s non-determinism with a novel interface for disjunctive delimited control, which gives the programmer not only control over the sequential (conjunctive) control flow, but also over the non-deterministic control flow. We provide a meta-interpreter that conservatively extends Prolog with delimited control and show that it enables a range of typical Prolog features and extensions, now at the library level: findall, cut, branch-and-bound optimisation, probabilistic programming, …

Information

Type
Rapid Communication
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.
Copyright
© The Author(s), 2023. Published by Cambridge University Press
Figure 0

Fig 1. Encoding of non-backtrackable state.

Figure 1

Fig 2. Meta-Interpreter Core.

Figure 2

Fig 3. Auxiliary Predicates for Meta-Interpreter Core.

Figure 3

Fig 4. Meta-Interpreter Toplevel.

Figure 4

Fig 5. Branch-and-Bound Effect Handler.

Figure 5

Fig 6. 2D Nearest Neighbour Search with Branch-and-Bound.

Figure 6

Fig 7. Nearest-Neighbour Search using a BSP-tree.

Figure 7

Fig 8. An implementation of PRISM-style probabilistic logic programming.

Figure 8

Fig 9. An implementation of PRISM-style probabilistic logic programming.

Figure 9

Fig 10. Encoding of conjunctive delimited control.

Figure 10

Fig 11. Interoperable Engines in terms of delimited control.