paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Back to Direct Style: Typed and Tight

回到直接风格:类型化且紧致
OOPSLA 7(OOPSLA1)2023匹配度 2/10 · 该论文是纯编程语言理论工作,研究有类型直接风格与CPS语言的互译、类型保持和操作对应,未涉及LLM/Agent、静态分析、浮点程序分析或贝叶斯程序分析等用户核心研究方向。引用 3 inbox
Marius Müller, Philipp Schuster, Jonathan Immanuel Brachthäuser, Klaus Ostermann
crossref: 2026-09-10

AI 速览

一句话:提出有类型直接风格与 CPS 语言及其互译,证明类型保持、操作对应,并刻画互译复合的逆性质。

CPS 变换是显式处理控制结构、用于编译的经典工具,在类型化场景下还可视为经典逻辑到直觉主义逻辑的嵌入。本文追问是否存在逆向的直接风格变换;答案取决于 CPS 变换的定义与逆变换的定义域。一般地,将 CPS 程序转回直接风格需借助控制操作符来处理非平凡使用延续的情况。作者给出两个语言:一个直接风格、一个 CPS,二者均有类型系统与抽象机语义,并支持非平凡控制流。文中定义正向与逆向翻译,证明二者保持类型,并以操作对应精确保持语义;还研究翻译复合的行为,证明在整个语言上为语法单侧逆,在平凡控制流受限时则为完全语法逆。

问题
研究 CPS 变换是否可逆,以及在存在非平凡控制流和延续使用时,如何将程序从 CPS 转回直接风格。
方法
定义带类型和抽象机语义的直接风格语言与 CPS 语言,设计正向 CPS 翻译与逆向直接风格翻译,并借助控制操作符处理非平凡延续。
评估
通过类型保持证明、操作对应证明以及翻译复合的逆性质分析进行评估,覆盖整个语言及限制到平凡控制流的情形。
原文摘要(Abstract)

Translating programs into continuation-passing style is a well-studied tool to explicitly deal with the control structure of programs. This is useful, for example, for compilation. In a typed setting, there also is a logical interpretation of such a translation as an embedding of classical logic into intuitionistic logic. A naturally arising question is whether there is an inverse translation back to direct style. The answer to this question depends on how the continuation-passing translation is defined and on the domain of the inverse translation. In general, translating programs from continuation-passing style back to direct style requires the use of control operators to account for the use of continuations in non-trivial ways. We present two languages, one in direct style and one in continuation-passing style. Both languages are typed and equipped with an abstract machine semantics. Moreover, both languages allow for non-trivial control flow. We further present a translation to continuation-passing style and a translation back to direct style. We show that both translations are type-preserving and also preserve semantics in a very precise way giving an operational correspondence between the two languages. Moreover, we show that the compositions of the translations are well-behaved. In particular, they are syntactic one-sided inverses on the full language and full syntactic inverses when restricted to trivial control flow.

链接与引用

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

BibTeX
@article{paperbot2031,
  title = {Back to Direct Style: Typed and Tight},
  author = {Marius Müller and Philipp Schuster and Jonathan Immanuel Brachthäuser and Klaus Ostermann},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {7},
  number = {OOPSLA1},
  year = {2023},
  doi = {10.1145/3586056}
}