Hostname: page-component-8448b6f56d-42gr6 Total loading time: 0 Render date: 2024-04-15T13:10:52.726Z Has data issue: false hasContentIssue false

Delimited continuations for prolog

Published online by Cambridge University Press:  25 September 2013

TOM SCHRIJVERS
Affiliation:
Ghent University, Belgium (e-mail: tom.schrijvers@ugent.be)
BART DEMOEN
Affiliation:
KU Leuven, Belgium (e-mail: bart.demoen@cs.kuleuven.be)
BENOIT DESOUTER
Affiliation:
Ghent University, Belgium (e-mail: benoit.desouter@ugent.be)
JAN WIELEMAKER
Affiliation:
University of Amsterdam, The Netherlands (e-mail: jan@swi-prolog.org)

Abstract

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.

Type
Regular Papers
Copyright
Copyright © 2013 [TOM SCHRIJVERS, BART DEMOEN, BENOIT DESOUTER and JAN WIELEMAKER] 

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

References

Aït-Kaci, H. 1991. Warren's Abstract Machine: A Tutorial Reconstruction. MIT Press.Google Scholar
Bowen, D., Byrd, L. and Clocksin, W. 1983. A portable Prolog compiler. In Proceedings of the Logic Programming Workshop, 74–83.Google Scholar
Branquart, P. and Lewi, J. 1970. A scheme of storage allocation and garbage collection for algol 68. In ALGOL 68 Implementation, North-Holland, 199238.Google Scholar
Costa, V. S., Rocha, R. and Damas, L. 2012. The YAP Prolog system. TPLP 12, 534.Google Scholar
Danvy, O. and Filinski, A. 1990. Abstracting control. In LFP '90, 151–160.Google Scholar
De Meuter, W. and Roman, G.-C., Eds. 2011. Coordination Models and Languages. LNCS, vol. 6721.Google Scholar
Demoen, B. 2002. Dynamic attributes, their hProlog implementation, and a first evaluation. Report CW 350, Department of Computer Science, KU Leuven, Belgium.Google Scholar
Demoen, B. and Nguyen, P.-L. 2000. So Many WAM Variations, so Little Time. LNAI, vol. 1861, 1240–1254.Google Scholar
Demoen, B. and Nguyen, P.-L. 2008. Two WAM Implementations of Action Rules. LNCS, vol. 5366, 621–635.Google Scholar
Demoen, B., Schrijvers, T. and Desouter, B. 2013. Delimited continuations in Prolog: Semantics, use and implementation in the WAM. Report CW 631, Department of Computer Science, KU Leuven, Belgium.Google Scholar
Felleisen, M. 1988. The theory and practice of first-class prompts. In POPL '88, 180–190.Google Scholar
Holzbaur, C. 1992. Meta-Structures vs. Attributed Variables in the Context of Extensible Unification. LNCS, vol. 631, 260–268.Google Scholar
Ivanovic, D., Morales Caballero, J. F., Carro, M. and Hermenegildo, M. 2009. Towards structured state threading in Prolog. In CICLOPS 2009.Google Scholar
Kiselyov, O. 2012. Iteratees. LNCS, vol. 7294, 166–181.Google Scholar
Kiselyov, O., Peyton-Jones, S. and Sabry, A. 2012. Lazy vs. yield: Incremental, lazy pretty-printing. In APLAS.Google Scholar
Le Houitouze, S. 1990. A New Data Structure for Implementing Extensions to Prolog. LNCS, vol. 456. 136–150.Google Scholar
Masuko, M. and Asai, K. 2009. Direct implementation of shift and reset in the MinCaml compiler. In ML'09, 49–60.Google Scholar
Moggi, E. 1991. Notions of computation and monads. Information and Computation 93, 1.Google Scholar
Neumerkel, U. 1990. Extensible unification by metastructures. In META'90, 352–364.Google Scholar
Plotkin, G. and Pretnar, M. 2009. Handlers of algebraic effects. In ESOP '09.CrossRefGoogle Scholar
Roy, P. V. 1989. A useful extension to prolog's definite clause grammar notation. 24, 11, 132134.Google Scholar
Schimpf, J. 2002. Logical loops. LNCS, vol. 2401. 224–238.Google Scholar
Swift, T. and Warren, D. S. 2012. XSB: Extending Prolog with tabled logic programming. TPLP 12, 1–2, 157187.Google Scholar
Tarau, P. 2012. The BinProlog experience: Architecture and implementation choices for continuation passing Prolog and first-class logic engines. TPLP 12, 1–2, 97126.Google Scholar
Tarau, P. and Dahl, V. 1994. Logic programming and logic grammars with first-order continuations. In LOPSTR '94. Vol. 883.CrossRefGoogle Scholar
Warren, D. H. D. 1983. An Abstract Prolog Instruction Set. Tech. Rep. 309, SRI.Google Scholar
Wielemaker, J. and Neumerkel, U. 2008. Precise garbage collection in Prolog. In CICLOPS '08, 1–15.Google Scholar
Wielemaker, J., Schrijvers, T., Triska, M. and Lager, T. 2012. SWI-Prolog. TPLP 12, 1–2, 6796.Google Scholar