In introductory programming courses, it is challenging for instructors to provide debugging feedback on students' incorrect programs. Some recent tools automatically offer program repair feedback by identifying any differences between incorrect and correct programs, but suffer from issues related to scalability, accuracy, and cross-language portability. This paper presents FAPR -- our novel approach that suggests repairs based on program differences in a fast and accurate manner. FAPR is different from current tools in three aspects. First, it encodes syntactic information into token sequences to enable high-speed comparison between incorrect and correct programs. Second, to accurately extract program differences, FAPR adopts a novel matching algorithm that maximizes token-level matches and minimizes statement-level differences. Third, FAPR relies on testing instead of static/dynamic analysis to validate and refine candidate repairs, so it eliminates the language dependency or high runtime overhead incurred by complex program analysis. We implemented FAPR to suggest repairs for both C and C++ programs; our experience shows the great cross-language portability of FAPR. More importantly, we empirically compared FAPR with a state-of-the-art tool Clara. FAPR suggested repairs for over 95.5% of incorrect solutions. We sampled 250 repairs among FAPR's suggestions, and found 89.6% of the samples to be minimal and correct. FAPR outperformed Clara by suggesting repairs for more cases, creating smaller repairs, producing higher-quality fixes, and causing lower runtime overheads. Our results imply that FAPR can potentially help instructors or TAs to effectively locate bugs in incorrect code, and to provide debugging hints/guidelines based on those generated repairs.
翻译:在入门编程课程中,教官很难提供对学生不正确的程序进行调试的反馈。最近的一些工具通过辨别不正确和正确的程序之间的任何差异,自动提供程序维修反馈,但遇到与可缩放性、准确性和跨语言可移植性有关的问题。本文介绍了FARPR,这是我们根据程序差异快速和准确地进行修复的新办法。FARP在三个方面与目前的工具不同。首先,它将综合信息编码成象征序列,以便能够对不正确和正确的程序进行高速比较。第二,为了准确地提取程序差异,FARP采用了一种新型匹配算法,使象征性匹配最大化,并尽量减少报表一级的差异。第三,FARPR依靠测试而不是静态/动态分析来验证和完善候选人的修理,从而消除了复杂的程序分析所产生的语言依赖性或高运行时间性间接费用。我们实施了FARPR建议对C和C++方案进行大跨语言的修理;我们的经验显示FARP的跨语言移动性移动性能大。更重要的是,我们把FARPR与更高级的帮助性比对高级工具进行最大程度的比对等,我们提出了更精确的修理建议,我们建议为超过95.5。