Delimited control in OCaml, abstractly and concretely

Delimited control in OCaml, abstractly and concretely
复制标题

OCaml 中的分隔控制,抽象和具体

DOI:
10.1016/j.tcs.2012.02.025
复制
发表时间:
2012
期刊:
Theor. Comput. Sci.
影响因子:
--
通讯作者:
O. Kiselyov
O. Kiselyov
中科院分区:
--
文献类型:
--
作者:
O. Kiselyov

文献摘要

被引文献

相似文献

我们描述了OCaml中多提示符分隔的控制操作符的第一个实现,它是直接的,因为它只捕获控制堆栈的所需部分。该实现是一个不需要对OCaml编译器或运行时进行更改的库,因此它与现有的OCaml源代码和二进制代码完全兼容。该图书馆自2006年以来一直在卓有成效的实际使用。我们目前的图书馆作为一个抽象的机器,通过阐述定义机器的实现。抽象视图允许我们提取一个最小的API,scAPI,足以实现多提示符分隔的控制。我们认为,一个语言系统,支持异常和堆栈溢出处理支持scAPI。以字节和本机代码OCaml系统为例,我们的库说明了如何使用scAPI在类型化语言中实现多提示符分隔的控制。该方法是通用的,并已被用来添加多提示符分隔控制到其他现有的语言系统。
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.