paperbot · PL 论文追踪

全部论文 待读 收藏

P2 P4-SpecTec: Integrating a Language Mechanization Framework into the Real-World P4 Specification

P4-SpecTec:将语言机械化框架集成到真实世界 P4 规范中
OOPSLA 10(OOPSLA2)2026匹配度 4/10 · 该论文属于形式语义、语言机械化与可执行类型检查器/解释器方向,具备理论形式化与工业落地案例,且是问题驱动地发现规范与编译器缺陷,与形式验证和静态分析有邻接价值;但它不涉及 LLM/Agent、机器学习系统、浮点程序分析或贝叶斯程序分析,与用户当前核心的 PL×AI 交叉方向不直接匹配。引用 1 inbox
Jaehyun Lee, Seokhun Jeong, Sehyuk Ahn, Haechan Kwon, Sukyoung Ryu
crossref: 2026-10-02

AI 速览

一句话:提出 P4-SpecTec,用可执行算法推理规则机械化 P4 静态/动态语义,生成类型检查器与解释器,发现 24 个 bug。

论文针对 P4 等语言在缺乏规范性规范时,规范、实现与形式化之间容易产生歧义和不一致的问题,提出语言机械化框架 P4-SpecTec。P4 是面向包处理器的静态类型领域特定语言,其类型系统机械化要求可执行,而现有 ESMeta 与 Wasm-SpecTec 不支持。P4-SpecTec 以算法化推理规则为主要手段,将 P4 静态与动态语义分别机械化为可执行的类型检查器和解释器。作者机械化最新 P4 规范,在官方规范与参考编译器中识别出 24 个 bug,并生成散文算法形式的规范文档。该工具链已被有条件采纳为官方 P4 规范编写工具链,并总结了将机械化集成到无规范语言的经验。

问题
P4 等语言缺乏完整无歧义的规范,导致规范、实现与形式化之间出现不一致;现有 ESMeta/Wasm-SpecTec 依赖已有规范且不支持可执行类型系统机械化。
方法
P4-SpecTec 以算法化推理规则为核心,将 P4 静态与动态语义机械化为可执行的类型检查器和解释器,并生成散文算法规范文档。
评估
机械化最新 P4 规范后,在官方规范和参考编译器中发现 24 个 bug,工具链被有条件采纳为官方 P4 规范编写工具链。
原文摘要(Abstract)

Programming languages evolve over time, but often without a complete and unambiguous definition of their syntax and semantics. Ambiguities and inconsistencies are silently introduced into specifications, and manifest as divergences between the specification, implementations, and formalizations that constitute the language ecosystem. Even in rare cases when a normative specification exists, like JavaScript and WebAssembly (Wasm), keeping the ecosystem in sync is a daunting task. Language mechanization frameworks address this problem by treating a mechanized specification as the single source of truth, from which implementations and documents are generated. Recently, this approach has been integrated into the actual JavaScript and Wasm specifications with ESMeta and Wasm-SpecTec, respectively. Despite these successes, it remains an open question how to extrapolate ESMeta and Wasm-SpecTec to other language specifications. Both framework designs leverage the existence of JavaScript and Wasm’s normative specifications, which is not the case for many languages. As a first step towards addressing this question, we present P4-SpecTec, a language mechanization framework for the P4 programming language, as a case study of real-world adoption of language mechanization. P4 is a statically-typed domain-specific language for programming packet processors. It is evolving without a normative specification, thereby introducing inconsistencies and errors into the P4 ecosystem. From a mechanization framework perspective, P4 introduces unique challenges, in particular the requirement that its type system mechanization should be executable, which is not supported by either ESMeta or Wasm-SpecTec. To address this challenge, we introduce algorithmic inference rules as the primary instrument for mechanization, enabling the mechanized P4 static and dynamic semantics to be executed as a P4 type checker and interpreter, respectively. We mechanized the most recent P4 specification, and utilizing its executability, identified 24 bugs across the official P4 specification and the reference compiler. Furthermore, P4-SpecTec derives a specification document as prose algorithms, making it accessible to P4 developers. P4-SpecTec is conditionally adopted as the official P4 specification authoring toolchain. We share the lessons learned from our case study, to provide insights for integrating mechanization into real-world languages without normative specifications.

链接与引用

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

BibTeX
@article{paperbot12139,
  title = {P4-SpecTec: Integrating a Language Mechanization Framework into the Real-World P4 Specification},
  author = {Jaehyun Lee and Seokhun Jeong and Sehyuk Ahn and Haechan Kwon and Sukyoung Ryu},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {10},
  number = {OOPSLA2},
  year = {2026},
  doi = {10.1145/3839535}
}