paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Lexical Effect Handlers, Directly

词法作用域效应处理器:直接实现
OOPSLA 8(OOPSLA2)2024匹配度 1/10 · 该论文研究效应处理器的编译策略与语言实现,属于程序语言/编译器方向,但未涉及用户核心关注的 PL+AI、静态分析、浮点程序分析、贝叶斯程序分析或 LLM/Agent 交叉。仅在“理论形式化+工程实现”偏好上有一般性共鸣,与研究方向基本无关。引用 10 inbox
Cong Ma, Zhaoyi Ge, Edward Lee, Yizhou Zhang
dblp: 2026-09-10crossref: 2026-09-10

AI 速览

一句话:提出词法作用域效应处理器的编译策略,将高层效应处理翻译为底层栈切换,并在 Lexa 中实现与验证。

词法作用域效应处理器为代数效应提供模块化语义,支持局部推理,同时保留效应处理器强大的控制流表达能力。然而现有实现可能付出类似动态作用域处理器运行时搜索的代价。本文提出一种面向词法作用域效应处理器的编译策略,遵循词法作用域原则,并以可低层控制栈布局的语言为目标;方法的关键部分被形式化并证明正确。作者在名为 Lexa 的语言中实现这些思想,其编译器将高层效应处理翻译为底层栈切换。基于一组基准的评估表明,Lexa 生成的代码高效,在某些情况下将运行时间复杂度从二次降为线性。

问题
现有词法作用域效应处理器实现可能引入类似动态作用域处理器的运行时查找开销,需要既能保持词法作用域局部推理又高效的编译方案。
方法
提出面向词法作用域效应处理器的编译策略,将高层效应处理转换为底层栈布局与栈切换操作,并形式化关键部分、证明正确;在 Lexa 中实现。
评估
用一组基准测试评估 Lexa 编译器,结果显示生成代码高效,某些场景将运行时间复杂度从二次降至线性。
原文摘要(Abstract)

Lexically scoping effect handlers is a language-design idea that equips algebraic effects with a modular semantics: it enables local-reasoning principles without giving up on the control-flow expressiveness that makes effect handlers powerful. However, we observe that existing implementations risk incurring costs akin to the run-time search for dynamically scoped handlers. This paper presents a compilation strategy for lexical effect handlers, adhering to the lexical scoping principle and targeting a language with low-level control over stack layout. Key aspects of this approach are formalized and proven correct. We embody the ideas in a language called L exa : the L exa compiler translates high-level effect handling to low-level stack switching. We evaluate the L exa compiler on a set of benchmarks; the results suggest that it generates efficient code, reducing running-time complexity from quadratic to linear in some cases.

链接与引用

DOI 原文 · PDF(开放获取) · DBLP

BibTeX
@article{MaGLZ24,
  title = {Lexical Effect Handlers, Directly},
  author = {Cong Ma and Zhaoyi Ge and Edward Lee and Yizhou Zhang},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {8},
  number = {OOPSLA2},
  year = {2024},
  doi = {10.1145/3689770}
}