一句话:提出端到端 Transformer 方法,结合代码上下文与编译诊断反馈,同时定位错误行并生成 C 程序修复替换。
自动修复编译错误能显著提升软件开发效率,尤其有助于新手或 AI 程序员调试代码。现有基于学习的程序修复虽已成为实践中的先进方法,但仍未充分利用错误代码上下文与编译器诊断反馈。本文提出端到端方案 TransRepair,使用 Transformer 神经网络同时定位错误行并生成正确替换,学习错误代码、上下文及诊断反馈中的修复模式。为提升效果,作者从真实程序数据集和互联网总结出 5 类、74 个细粒度编译错误子类型,并通过程序破坏技术合成包含 1,821,275 个错误 C 程序的大规模数据集。实验表明,TransRepair 在单次修复准确率和完整修复准确率上均优于当时最先进方法,并进一步分析了现有方案的强弱。
Automatically fixing compilation errors can greatly raise the productivity of software development, by guiding the novice or AI programmers to write and debug code. Recently, learning-based program repair has gained extensive attention and became the state-of-the-art in practice. But it still leaves plenty of space for improvement. In this paper, we propose an end-to-end solution TransRepair to locate the error lines and create the correct substitute for a C program simultaneously. Superior to the counterpart, our approach takes into account the context of erroneous code and diagnostic compilation feedback. Then we devise a Transformer-based neural network to learn the ways of repair from the erroneous code as well as its context and the diagnostic feedback. To increase the effectiveness of TransRepair, we summarize 5 types and 74 fine-grained sub-types of compilations errors from two real-world program datasets and the Internet. Then a program corruption technique is developed to synthesize a large dataset with 1,821,275 erroneous C programs. Through the extensive experiments, we demonstrate that TransRepair outperforms the state-of-the-art in both single repair accuracy and full repair accuracy. Further analysis sheds light on the strengths and weaknesses in the contemporary solutions for future improvement.
@inproceedings{paperbot7197,
title = {TransRepair: Context-aware Program Repair for Compilation Errors},
author = {Xueyang Li and Shangqing Liu and Ruitao Feng and Guozhu Meng and Xiaofei Xie and Kai Chen and Yang Liu},
booktitle = {ASE},
year = {2022},
doi = {10.1145/3551349.3560422}
}