arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1608.00816cs.PL
收藏

Prolog中有效的代数效果处理器

Efficient Algebraic Effect Handlers for Prolog

Amr Hany Saleh, Tom Schrijvers

摘要:

最近的工作为Prolog提供了定界控制,以动态地操纵程序控制流,并在此基础上实现了广泛的控制流和控制流效果。不幸的是,分隔控件是一个相当原始的语言特性,不容易使用。作为一种补救措施,这项工作介绍了Prolog的代数效果处理程序,作为一个高层次和结构化的方式定义新的副作用,在一个模块化的方式。我们说明了表达能力的功能,并提供了一个实现的手段,制定到定界控制原语。后者在广泛使用时会增加不可忽略的性能开销。为了解决这个问题,我们提出了一个优化的编译方法,结合部分评估专用重写规则。重写规则由轻量级效果推理驱动,该轻量级效果推理分析目标可以调用什么效果操作。我们在一系列基准上说明了这种方法的有效性。本条款正在考虑在TPLP中接受。

英文摘要:

Recent work has provided delimited control for Prolog to dynamically manipulate the program control-flow, and to implement a wide range of control-flow and dataflow effects on top of. Unfortunately, delimited control is a rather primitive language feature that is not easy to use. As a remedy, this work introduces algebraic effect handlers for Prolog, as a high-level and structured way of defining new side-effects in a modular fashion. We illustrate the expressive power of the feature and provide an implementation by means of elaboration into the delimited control primitives. The latter add a non-negligible performance overhead when used extensively. To address this issue, we present an optimised compilation approach that combines partial evaluation with dedicated rewrite rules. The rewrite rules are driven by a lightweight effect inference that analyses what effect operations may be called by a goal. We illustrate the effectiveness of this approach on a range of benchmarks. This article is under consideration for acceptance in TPLP.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑