paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Semantics Lifting for Syntactic Sugar

语法糖的语义提升
OOPSLA 8(OOPSLA2)2024匹配度 2/10 · 论文属于PL形式语义/DSL领域,讨论语法糖的语义提升、正确性与抽象性,与用户关注的LLM/Agentic程序静态分析、浮点程序分析、贝叶斯程序分析及其与LLM交叉无直接关系,仅在形式化方法大类上有弱关联。引用 2 inbox
Zhichao Guan, Yiyuan Cao, Tailai Yu, Ziheng Wang, Di Wang, Zhenjiang Hu
dblp: 2026-09-10crossref: 2026-09-10

AI 速览

一句话:提出语义提升框架,可从宿主语言语义与脱糖规则静态派生语法糖的自包含求值规则,并保证正确性与抽象性。

语法糖在通用语言和领域特定语言中广泛使用,能提供便捷语法和更高层抽象。但传统做法把含语法糖的程序翻译回宿主语言,会造成抽象泄漏,破坏便利性并影响程序理解。本文提出语义提升(semantics lifting),旨在为语法糖静态推导自包含的求值规则。其框架包含:从宿主语言语义与脱糖规则推导宿主无关语义的通用算法;提升语义的正确性与抽象性形式化定义;保证提升语义可证明正确且抽象的充分条件。作者实现 Osazone 并开展多个案例研究,表明该方法灵活、有效,适合实现领域特定语言。

问题
传统将含语法糖的程序翻译或脱糖到宿主语言会导致抽象泄漏,破坏语法糖提供的便利性与程序可理解性。
方法
提出语义提升框架,从宿主语言语义和脱糖规则静态推导宿主无关的自包含求值规则,并给出正确性与抽象性定义及充分条件。
评估
实现系统 Osazone,并通过多个案例研究展示该方法在实现领域特定语言时灵活、有效且实用。
原文摘要(Abstract)

Syntactic sugar plays a crucial role in engineering programming languages. It offers convenient syntax and higher-level of abstractions, as witnessed by its pervasive use in both general-purpose and domain-specific contexts. Unfortunately, the traditional approach of translating programs containing syntactic sugars into the host language can lead to abstraction leakage, breaking the promise of convenience and hindering program comprehension. To address this challenge, we introduce the idea of semantics lifting that aims to statically derive self-contained evaluation rules for syntactic sugars. More specifically, we propose a semantics-lifting framework that consists of (i) a general algorithm for deriving host-independent semantics of syntactic sugars from the semantics of the host language and the desugaring rules, (ii) a formulation of the correctness and abstraction properties for a lifted semantics, and (iii) a systematic investigation of sufficient conditions that ensure a lifted semantics is provably correct and abstract. To evaluate our semantics-lifting framework, we have implemented a system named Osazone and conducted several case studies, demonstrating that our approach is flexible, effective, and practical for implementing domain-specific languages.

链接与引用

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

BibTeX
@article{GuanCYW0H24,
  title = {Semantics Lifting for Syntactic Sugar},
  author = {Zhichao Guan and Yiyuan Cao and Tailai Yu and Ziheng Wang and Di Wang and Zhenjiang Hu},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {8},
  number = {OOPSLA2},
  year = {2024},
  doi = {10.1145/3689758}
}