GGF: A Graph-based Method for Programming Language Syntax Error Correction
GGF: A Graph-based Method for Programming Language Syntax Error Correction
复制标题
DOI:
10.1145/3387904.3389252
复制
发表时间:
2020-07
期刊:
影响因子:
--
通讯作者:
Liwei Wu;Fei Li;Youhua Wu;Tao Zheng
中科院分区:
文献类型:
--
作者:
Liwei Wu;Fei Li;Youhua Wu;Tao Zheng
Syntax errors combined with obscure error messages generated by compilers usually annoy programmers and cause them to waste a lot of time on locating errors. The existing models do not utilize the structure in the code and just treat the code as token sequences. It causes low accuracy and poor performance on this task. In this paper, we propose a novel deep supervised learning model, called Graph-based Grammar Fix(GGF), to help programmers locate and fix the syntax errors. GGF treats the code as a mixture of the token sequences and graphs. The graphs build upon the Abstract Syntax Tree (AST) structure information. GGF encodes an erroneous code with its sub-AST structure, predicts the error position using pointer network and generates the right token. We utilized the DeepFix dataset which contains 46500 correct C programs and 6975 programs with errors written by students taking an introductory programming course. GGF is trained with the correct programs from the DeepFix dataset with intentionally injected syntax errors. After training, GGF could fix 4054 (58.12%) of the erroneous code, while the existing state of the art tool DeepFix fixes 1365 (19.57%) of the erroneous code.