paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Automatically deriving control-flow graph generators from operational semantics

从操作语义自动派生控制流图生成器
ICFP 6(ICFP)2022匹配度 4/10 · 该论文属于PL/形式语义与静态分析基础设施,研究从操作语义自动合成CFG生成器并用于构建静态分析,与用户对静态分析、形式化验证的兴趣有一定交集;但它不涉及LLM/Agent、ML系统、浮点程序分析或贝叶斯程序分析,与用户当前核心研究方向匹配有限。引用 3 inbox
James Koppel, Jackson Kearl, Armando Solar-Lezama
crossref: 2026-09-10

AI 速览

一句话:提出从操作语义自动合成多种控制流图生成器的理论、算法与工具 Mandate。

现有控制流图(CFG)生成器通常需针对具体语言和工具手写,缺乏从操作语义系统派生 CFG 的理论。本文首先给出从小步操作语义到大类抽象机的转换算法,再用 abstract rewriting 自动抽象语言语义,并通过抽象与投影参数控制生成不同家族的 CFG 生成器:既可直接解释程序生成 CFG,也可生成类似人工编写的独立代码。文中证明生成图与原始语义的对应性,并给出自动证明解释模式生成器终止性的算法。作者实现工具 Mandate,在两种含 60–80 条规则、覆盖现代语言多数过程内控制构造的中型语言上生成人类可读代码,并基于这些生成器构建了两个静态分析,验证其实用性。

问题
如何从编程语言的操作语义自动派生多种控制流图生成器,而无需为每种语言和工具手工编写 CFG 生成器。
方法
将小步操作语义转换为抽象机,利用 abstract rewriting 抽象语义,并通过抽象与投影参数生成解释模式或独立代码形式的 CFG 生成器,同时证明其与源语义的对应性及解释模式的终止性。
评估
在 Mandate 中实现该方法,于两种含 60–80 条规则的中型语言上生成可读 CFG 生成器,并以此搭建两个静态分析以验证生成器可用性。
原文摘要(Abstract)

We develop the first theory of control-flow graphs from first principles, and use it to create an algorithm for automatically synthesizing many variants of control-flow graph generators from a language’s operational semantics. Our approach first introduces a new algorithm for converting a large class of small-step operational semantics to an abstract machine. It next uses a technique called ”abstract rewriting” to automatically abstract the semantics of a language, which is used both to directly generate a CFG from a program (”interpreted mode”) and to generate standalone code, similar to a human-written CFG generator, for any program in a language. We show how the choice of two abstraction and projection parameters allow our approach to synthesize several families of CFG-generators useful for different kinds of tools. We prove the correspondence between the generated graphs and the original semantics. We provide and prove an algorithm for automatically proving the termination of interpreted-mode generators. In addition to our theoretical results, we have implemented this algorithm in a tool called Mandate, and show that it produces human-readable code on two medium-size languages with 60−80 rules, featuring nearly all intraprocedural control constructs common in modern languages. We then show these CFG-generators were sufficient to build two static analyses atop them. Our work is a promising step towards the grand vision of being able to synthesize all desired tools from the semantics of a programming language.

链接与引用

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

BibTeX
@article{paperbot1480,
  title = {Automatically deriving control-flow graph generators from operational semantics},
  author = {James Koppel and Jackson Kearl and Armando Solar-Lezama},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {6},
  number = {ICFP},
  year = {2022},
  doi = {10.1145/3547648}
}