[Paper Review] FAPR: Fast and Accurate Program Repair for Introductory Programming Courses
FAPR is a fast and accurate program repair system for introductory programming courses that leverages token-level comparison with syntactic encoding and testing-based validation to generate minimal, correct repairs. It achieves 95.5% repair suggestion coverage and 89.6% correctness on sampled repairs, outperforming Clara in speed, accuracy, and cross-language portability for C and C++ programs.
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.
Motivation & Objective
- To address the challenge of providing scalable, accurate, and cross-language program repair feedback in introductory programming courses.
- To reduce the high runtime overhead and language dependency of existing tools that rely on complex static or dynamic analysis.
- To improve repair quality by minimizing code changes while preserving algorithmic intent through syntactic encoding and statement-level difference minimization.
- To enable efficient, portable, and accurate repair suggestions using only test cases and token-level comparison, avoiding manual error modeling or complex program analysis.
Proposed method
- FAPR first identifies up to 100 correct programs most similar to an incorrect program via longest common subsequence (LCS) of token sequences.
- It enhances token sequences with depth information from abstract syntax trees (ASTs) to encode syntactic structure and improve comparison accuracy.
- A novel matching algorithm selects the LCS that minimizes statement-level differences, ensuring repairs are minimal and semantically meaningful.
- FAPR normalizes the selected correct program by replacing variable names with those from the incorrect program to align syntax.
- It generates candidate repairs by exploring subsets of code differences between the normalized correct and incorrect programs.
- Each candidate repair is validated using automated testing, ensuring correctness without relying on static or dynamic program analysis.
Experimental results
Research questions
- RQ1Can a program repair system achieve high speed and accuracy without relying on complex static or dynamic analysis?
- RQ2How effective is token-level comparison enhanced with syntactic encoding in generating minimal and correct repairs?
- RQ3To what extent can a testing-based validation approach ensure cross-language portability and repair quality?
- RQ4How does FAPR compare to state-of-the-art tools like Clara in repair coverage, correctness, and performance?
Key findings
- FAPR suggested repairs for 99% of 6,676 incorrect C programs and 95.5% of 20,897 C/C++ programs, demonstrating high repair coverage.
- Among 250 sampled repairs, 89.6% were minimal and correct, indicating high repair quality.
- FAPR outperformed Clara in all metrics: higher repair suggestion rate, smaller repair size, better fix quality, and lower runtime overhead.
- FAPR achieved a total preprocessing time of only 306 seconds for 14,221 correct programs, highlighting its efficiency.
- The system required almost zero developer effort to port from C to C++, confirming strong cross-language portability.
- FAPR’s testing-based validation eliminated dependency on language-specific analysis, enabling broad applicability across programming languages.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.