paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Staged Compilation with Module Functors

带模块函子的分阶段编译
ICFP 8(ICFP)2024匹配度 2/10 · 该论文属于纯编程语言类型系统与多阶段编程方向,研究 OCaml 模块函子与宏系统的形式化,但未涉及 LLM/Agent、静态分析、浮点程序分析或贝叶斯程序分析等用户核心方向。其类型可靠性与阶段区分的形式化方法可能与 PL 理论兴趣相关,但整体匹配度低。引用 4 inbox
Tsung-Ju Chiang, Jeremy Yallop, Leo White, Ningning Xie
dblp: 2026-09-10crossref: 2026-09-10

AI 速览

一句话:将多阶段编程与 OCaml 模块函子结合,形式化设计并证明类型可靠性与阶段区分。

多阶段编程可消除抽象与性能的矛盾,但其与大规模程序语言特性(如模块系统)的交互尚缺研究,阻碍其集成到现有语言并在大程序中有效使用。本文以 OCaml 宏扩展 MacoCaml 为基础,研究如何将编译期代码生成(宏与引用)与模块函子结合,讨论求值顺序等设计选择,并通过精化(elaboration)给出形式化演算。作者证明该设计满足句法类型可靠性、精化可靠性以及阶段区分等关键元理论性质。该工作为 OCaml 宏系统的后续探索与实现奠定基础。

问题
多阶段编程特性与 OCaml 模块函子等大规模编程特性的交互尚未被充分研究,限制了分阶段编程在大型程序中的集成与使用。
方法
在支持宏与引用的 MacoCaml 基础上扩展模块函子,讨论求值顺序等设计选择,并通过 elaboration 建立形式化演算。
评估
以形式化元理论证明评估设计,证明句法类型可靠性、精化可靠性和阶段区分等关键性质。
原文摘要(Abstract)

Multi-stage programming has been used in a wide variety of domains to eliminate the tension between abstraction and performance. However, the interaction of multi-stage programming features with features for programming-in-the-large remains understudied, hindering the full integration of multi-stage programming support into existing languages, and limiting the effective use of staging in large programs. We take steps to remedy the situation by studying the extension of MacoCaml, a recent OCaml extension that supports compile-time code generation via macros and quotations , with module functors, the key mechanism in OCaml for assembling program components into larger units. We discuss design choices related to evaluation order, formalize our calculus via elaboration, and show that the design enjoys key metatheoretical properties: syntactic type soundness, elaboration soundness, and phase distinction. We believe that this study lays a foundation for the continued exploration and implementation of the OCaml macro system.

链接与引用

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

BibTeX
@article{ChiangYWX24,
  title = {Staged Compilation with Module Functors},
  author = {Tsung-Ju Chiang and Jeremy Yallop and Leo White and Ningning Xie},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {8},
  number = {ICFP},
  year = {2024},
  doi = {10.1145/3674649}
}