Delimited control in OCaml, abstractly and concretely

Research output: Contribution to journalArticlepeer-review

9 Citations (Scopus)

Abstract

We describe the first implementation of multi-prompt delimited control operators in OCaml that is direct in that it captures only the needed part of the control stack. The implementation is a library that requires no changes to the OCaml compiler or run-time, so it is perfectly compatible with existing OCaml source and binary code. The library has been in fruitful practical use since 2006. We present the library as an implementation of an abstract machine derived by elaborating the definitional machine. The abstract view lets us distill a minimalistic API, scAPI, sufficient for implementing multi-prompt delimited control. We argue that a language system that supports exception and stack-overflow handling supports scAPI. With byte- and native-code OCaml systems as two examples, our library illustrates how to use scAPI to implement multi-prompt delimited control in a typed language. The approach is general and has been used to add multi-prompt delimited control to other existing language systems.

Original languageEnglish
Pages (from-to)56-76
Number of pages21
JournalTheoretical Computer Science
Volume435
DOIs
Publication statusPublished - 2012 Jun 1

Keywords

  • Abstract machine
  • Delimited continuation
  • Exception
  • Implementation
  • Semantics

ASJC Scopus subject areas

  • Theoretical Computer Science
  • Computer Science(all)

Fingerprint

Dive into the research topics of 'Delimited control in OCaml, abstractly and concretely'. Together they form a unique fingerprint.

Cite this