paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Multi-stage Programming with Splice Variables

带 splice 变量的多阶段编程
ICFP 9(ICFP)2025匹配度 2/10 · 论文属于纯程序语言理论中的多阶段编程与类型系统研究,涉及形式语义和证明机械化,与用户关注的 LLM/Agent 结合静态分析、浮点程序分析或贝叶斯程序分析没有直接关系。虽然形式上属于 PL 与形式化验证,但研究目标和应用场景均不匹配画像核心方向。引用 1 inbox
Tsung-Ju Chiang, Ningning Xie
crossref: 2026-09-10

AI 速览

一句话:提出带 let-splice 绑定的多阶段演算 λ○▷,用上下文模态类型系统支持 splice 变量,并扩展到代码模式匹配。

多阶段编程通过 quote-and-splice 支持类型化元编程,但传统语法难以管理表达式求值,并给代码模式匹配等高级特性带来复杂机制。本文提出多阶段演算 λ○▷,引入 let-splice 绑定,将 splice 表达式显式绑定到 splice 变量,从而灵活地管理、共享和复用 splice 计算。受上下文模态类型论启发,类型系统为类型关联类型上下文,以刻画 splice 变量的变量依赖。该机制可扩展到代码模式匹配与重写,形成 λ○▷pat。作者证明两个演算的语法类型可靠性,并用 Kripke 风格模型给出指称语义与 adequacy 结果;所有证明均在 Agda 中机器化。

问题
传统 quote-and-splice 多阶段编程在表达式求值管理上较为复杂,且代码模式匹配等高级特性往往需要繁重机制。
方法
提出 λ○▷ 及 let-splice 绑定,并基于上下文模态类型论设计带类型上下文的类型系统,进一步扩展出支持代码模式匹配与重写的 λ○▷pat。
评估
证明两个演算的语法类型可靠性,用 Kripke 风格指称语义证明 adequacy,并在 Agda 证明助手中机器化全部证明。
原文摘要(Abstract)

Multi-stage programming is a popular approach to typed meta-programming, reducing abstraction overhead and producing performant programs. However, the traditional quote-and-splice staging syntax, as introduced by Rowan Davies in 1996, can introduce complexities in managing expression evaluation, and also often necessitates sophisticated mechanisms for advanced features such as code pattern matching. This paper introduces λ ○▷ , a novel staging calculus featuring let-splice bindings, a construct that explicitly binds splice expressions to splice variables, providing flexibility in managing, sharing, and reusing splice computations. Inspired by contextual modal type theory, our type system associates types with a typing context to capture variables dependencies of splice variables. We demonstrate that this mechanism seamlessly scales to features like code pattern matching, by formalizing λ ○▷ pat , an extension of λ ○▷ with code pattern matching and rewriting. We establish the syntactic type soundness of both calculi. Furthermore, we define a denotational semantics using a Kripke-style model, and prove adequacy results. All proofs have been fully mechanized using the Agda proof assistant.

链接与引用

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

BibTeX
@article{paperbot3051,
  title = {Multi-stage Programming with Splice Variables},
  author = {Tsung-Ju Chiang and Ningning Xie},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {ICFP},
  year = {2025},
  doi = {10.1145/3747518}
}