paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Program Skeletons for Automated Program Translation

面向自动化程序翻译的程序骨架
PLDI 9(PLDI)2025匹配度 3/10 · 论文属于程序语言、程序合成与跨语言翻译方向,与 PL 有泛领域关联;但未涉及静态分析、LLM/Agent、浮点程序分析或贝叶斯程序分析等用户核心研究方向,因此匹配度较低。引用 0 inbox
Bo Wang, Tianyu Li, Ruishi Li, Umang Mathur, Prateek Saxena
crossref: 2026-09-10

AI 速览

一句话:提出程序骨架方法,将跨语言翻译分解为可机械翻译的骨架与可综合的代码片段,实现 Python 到 JavaScript 翻译。

跨语言程序翻译需在抽象掉源语言细节的同时,用目标语言惯用构造重新表达源程序行为,因此难以自动化并扩展到较大程序。本文提出“程序骨架”框架:骨架保留源程序高层结构,将低层具体代码片段抽象并总结;骨架可机械翻译,片段可由现有数据驱动代码合成器填充。该设计支持可靠分解——只要每个片段正确翻译,与机械翻译的骨架组合后整体程序即可视为正确。作者实现原型 Skel,支持 Python 到 JavaScript 翻译。在 9 个真实 Python 程序(部分超过约 1k 行)上,95% 代码片段可自动翻译,约 5% 需人工;所有最终翻译均通过全程序测试套件,扩展性相比先前工作有前景。

问题
跨语言程序翻译如何自动化并扩展到较大程序;核心难点是抽象源语言细节,同时用目标语言惯用构造保持原功能。
方法
提出程序骨架:保留源程序高层结构,将低层具体片段抽象总结;骨架可机械翻译,片段可由数据驱动合成器填充,并支持若片段均正确则整体正确的可靠分解。
评估
实现 Python 到 JavaScript 原型 Skel;在 9 个真实 Python 程序(部分约 1k 行)上,95% 片段自动翻译、5% 需人工,最终翻译均通过全程序测试套件,扩展性优于先前工作。
原文摘要(Abstract)

Translating software between programming languages is a challenging task, for which automated techniques have been elusive and hard to scale up to larger programs. A key difficulty in cross-language translation is that one has to re-express the intended behavior of the source program into idiomatic constructs of a different target language. This task needs abstracting away from the source language-specific details, while keeping the overall functionality the same. In this work, we propose a novel and systematic approach for making such translation amenable to automation based on a framework we call program skeletons. A program skeleton retains the high- level structure of the source program by abstracting away and effectively summarizing lower-level concrete code fragments, which can be mechanically translated to the target programming language. A skeleton, by design, permits many different ways of filling in the concrete implementation for fragments, which can work in conjunction with existing data-driven code synthesizers. Most importantly, skeletons can conceptually enable sound decomposition, i.e., if each individual fragment is correctly translated, taken together with the mechanically translated skeleton, the final translated program is deemed to be correct as a whole. We present a prototype system called Skel embodying the idea of skeleton-based translation from Python to JavaScript. Our results show promising scalability compared to prior works. For 9 real-world Python programs, some with more than about 1 k lines of code, 95% of their code fragments can be automatically translated, while about 5% require manual effort. All the final translations are correct with respect to whole-program test suites.

链接与引用

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

BibTeX
@article{paperbot3120,
  title = {Program Skeletons for Automated Program Translation},
  author = {Bo Wang and Tianyu Li and Ruishi Li and Umang Mathur and Prateek Saxena},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {PLDI},
  year = {2025},
  doi = {10.1145/3729287}
}