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
期刊:
2020 IEEE/ACM 28th International Conference on Program Comprehension (ICPC)
影响因子:
--
通讯作者:
Liwei Wu;Fei Li;Youhua Wu;Tao Zheng
Liwei Wu;Fei Li;Youhua Wu;Tao Zheng
中科院分区:
其他
文献类型:
--
作者:
Liwei Wu;Fei Li;Youhua Wu;Tao Zheng

文献摘要

被引文献

相似文献

语法错误与编译器生成的模糊错误消息相结合,通常会使程序员感到烦恼,并导致他们在定位错误上浪费大量时间。现有的模型没有利用代码中的结构,只是将代码视为标记序列。它导致该任务的准确性低,性能差。在本文中,我们提出了一种新的深度监督学习模型,称为基于图的语法修复(GGF),以帮助程序员定位和修复语法错误。GGF将代码视为标记序列和图形的混合物。图建立在抽象语法树(AST)结构信息的基础上。GGF利用其子ast结构对错误码进行编码,利用指针网络预测错误位置,生成正确的令牌。我们使用了DeepFix数据集,其中包含46500个正确的C程序和6975个有错误的程序,这些程序是由参加入门编程课程的学生编写的。GGF使用来自DeepFix数据集的正确程序进行训练,并故意注入语法错误。经过训练,GGF可以修复4054个(58.12%)错误代码,而现有的先进工具DeepFix修复了1365个(19.57%)错误代码。
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.