The invention relates to a code
error feedback method combining
static analysis and dynamic analysis, and mainly solves the problems of insufficient
error feedback and low efficiency in an Online Judge
system: reconstructing codes of correct and error versions, including alignment and renaming of variables, and rearranging statements on the premise of not influencing
semantics; static and dynamic multi-level alignment is carried out, in the static alignment, an editing script with the minimum cost is calculated through a
heuristic editing distance
algorithm, an alignment block and a
difference list are obtained, in the dynamic alignment, compiling execution is carried out on source codes of two versions, test cases which do not pass operation are dynamically printed through gdb, and execution track information of the test cases is dynamically printed through gdb; error positioning is achieved, data flow
backtracking analysis and scoring are carried out on error positions, and
error feedback is generated. The method has the characteristics of high execution efficiency, high accuracy and easier understanding of generated feedback, automatic feedback of error codes can be realized, and the learning efficiency of students in
programming tasks is improved.