# Mining on Students' Execution Logs and Repairing Compilation Errors Based on Deep Learning
## 3 Mining on Students' Execution Logs
Due to the inherent similarity between syntax errors in programming and grammar errors in natural language [10], we draw an analogy to grammatical error correction in natural language. To this end, we utilize real erroneous program statements, along with their corresponding correct fix examples, as a dataset for training the Transformer translation model. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Task** & **Mining Strategy** & **Amount of Sample Pairs** & **Amount of Error Types** & **Average Number of Errors per Sample Pair** \\ \hline \multirow{3}{*}{Task1} & Strategy 1 & 140 & 5 & 1.55 \\  & Strategy 2 & 24 & 4 & 1.21 \\  & Strategy 3 & 15 & 4 & 1.47 \\ \hline \multirow{3}{*}{Task2} & Strategy 1 & 407 & 7 & 1.81 \\  & Strategy 2 & 280 & 4 & 1.18 \\  & Strategy 3 & 303 & 6 & 1.48 \\ \hline \multirow{3}{*}{Task3} & Strategy 1 & 343 & 7 & 2.14 \\  & Strategy 2 & 207 & 3 & 1.08 \\ \cline{1-1}  & Strategy 3 & 192 & 6 & 1.44 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Result of program pairs mining. During the model training phase, the correct programs are used as the source data, while the erroneous programs serve as the target data. The Transformer model is trained to predict and generate erroneous program statements based on the correct code. The generated program statements are then compiled to verify their correctness. The erroneous programs that result in compilation errors are retained as the output. The retained code statements are filtered based on an edit distance [21] threshold of less than or equal to 5. These filtered statements are then paired with the corresponding source program code statements used during the prediction phase of the model, thereby creating the generated program pairs dataset. In the prediction phase, taking Figure 3 as an example, the correct program is first abstracted and input into the trained RS model. This generates multiple predicted erroneous programs, denoted as Pred#n. Next, all generated program statements are fed into a compiler for validation. Since \"int main()\" and \"int main(void)\" are equivalent and do not result in compilation errors, Pred#1 is filtered out at this stage. Subsequently, during the edit distance filtering step, Pred#2, which has deleted a line of content, exceeds the edit distance threshold when compared to the input program. However, Pred#3 has an edit distance of 2 compared to the input program and is ultimately paired with the correct program, resulting in a generated program repair example. Figure 2: Flowchart of Rookie Simulator. ## 5 Repairing Compilation Errors

The feedback information provided by the compiler can assist in pinpointing the precise location of errors, offering relevant prompts pertaining to the errors, and effectively guiding program repair. To extract the underlying semantics embedded within code statements and compiler feedback information more effectively, we propose the ACNPR model--which aims to learn the intricate characteristics and syntactic-semantic relationships of erroneous programs, ultimately generating repair patches. ### Data Preprocessing

To obtain a richer set of program error feature information and facilitate the localization and reasoning capabilities of the repair model, we performed data preprocessing on the program repair dataset. This included line tokenization, compiler compilation, and the construction of program-feedback graphs. We divided the program into lines and assigned a unique number to each line. Based on the repair examples in the dataset, we identified the lines containing errors and labeled them accordingly. This process allowed us to obtain the line numbers corresponding to the errors and their corresponding repair patches on a single line basis. We compiled the erroneous programs in the dataset using the GNU compiler collection and extracted the compiler feedback information. Each feedback from GCC contains source file information, error location information, and error description.