# Mining on Students' Execution Logs and Repairing Compilation Errors Based on Deep Learning
## 3 Mining on Students' Execution Logs
For example, in the feedback message \"e158_277497.c:10:18: expected identifier or '(' before'return,\"

Figure 3: Example of model predictions. The modifications made to the input program in the predicted programs are highlighted in red font. \"e158_277497.c\" represents the name of the compiled C program, \"10\" indicates the line number where the error is identified by the compiler, and \"18\" represents the column number of the error location. The phrase \"expected identifier or \"(\" before'return'\" is the compiler's description of the error. We extracted the line number indicating the location of the error as guidance for the repair model to locate the errors. Additionally, we extracted the error description information as a part of the model input. The construction of program-feedback graphs is guided by [PERSON] et al. [13] and involves identifying key information (e.g., \"return\") from error descriptions and locating the corresponding tokens in the source code. These tokens are then connected to form the graph. For each program, a program-feedback graph is built, consisting of inter-connected subgraphs that represent different key symbols. This graphical representation effectively abstracts the relationships between the same key symbols at different locations. ### Model Architecture

The given input--which includes the program code along with the corresponding compiler error information, such as line number and error description--can be trans-formed into a sequential input model. Additionally, the program-feedback graph is constructed to directly connect important symbols related to program repairs. The source code semantics, error message features, and program-feedback graph features are then aggregated. An attention-enhanced capsule network is employed to fuse higher-order features and reconstruct semantic information, and ultimately, the decoding layer outputs the predicted error line number and the corresponding repair sequence. The error line index in the model's output corresponds to the line where the predicted modification patch is located, which is different from the input compiler error line. The overall architecture of the ACNPR model is illustrated in Figure 4. The model takes the program statement sequence \(x_{i}=(x_{i1},x_{i2},\ldots,x_{ij})\), error line number \(i_{err}\), and error description sequence \(M_{err}=(M_{1},M_{2},\ldots,M_{n})\) as input and predicts the error line number \(k\) and the corresponding repair code sequence \(y_{k}=(Y_{1},Y_{2},\ldots,Y_{m})\) as output. The values of line number \(i\) and the length of each line sequence \(j\) are variable and depend on the maximum values within the current batch. The loss function used in the model is the standard negative log-likelihood. The model structure mainly consists of four parts: the encoding, graph attention, capsule network, and decoding layers. The encoding layer encodes the source code sequence and the compiler error information, resulting in a hidden state \(\mathbf{h}\). The graph attention layer incorporates the symbol association information of the source code and error information, based on the constructed program-feedback graph, into the hidden state \(\mathbf{h}\) through attention, yielding a corresponding state \(\mathbf{g}\). The capsule network layer utilizes a capsule network to aggregate higher-order features. It fuses the captured feature values into the semantics, incorporating the contextual semantic information of the source code and that of the compiler error information through attention, resulting in an output state \(\mathbf{o}\). The decoding layer decodes based on the hidden state obtained from the upper layers, predicting the probability distribution of the error line number and the corresponding repair patch. #### 5.2.1 Encoding Layer

Given the source code sequence \(x_{i}=(x_{i1},x_{i2},\ldots)\), we encoded it at the line level using a bidirectional long short-term memory (BiLSTM) network denoted as BiLSTM\({}^{(1)}_{\text{code}}\), which outputs the hidden state \(\mathbf{h}\).