评估句法结构对学习代码编辑表示的有效性
Assessing the Effectiveness of Syntactic Structure to Learn Code Edit Representations
摘要:
最近,已经表明可以使用代码作为数据来帮助各种应用,例如自动提交消息生成,自动生成拉取请求描述和自动程序修复。以提交消息生成的问题为例。将源代码视为令牌序列,现有技术使用神经机器翻译模型生成提交消息。然而,他们往往忽略了程序设计语言的语法结构。以前的工作,即,code2seq使用了抽象树(AST)的结构信息来表示源代码,并使用它来自动生成方法名称。在本文中,我们详细阐述了这种最先进的方法,并修改它来表示源代码编辑。我们确定使用这样的句法结构的分类代码编辑的问题的影响。受code2seq方法的启发,我们评估了如何使用来自AST的结构信息,即,AST叶节点之间的路径可以帮助完成对两个细粒度语法编辑数据集进行代码编辑分类的任务。我们的实验表明,尝试添加语法结构并没有导致任何改进不太复杂的方法。结果表明,code2seq等技术虽然很有前途,但在普遍应用于学习代码编辑表示之前还有很长的路要走。我们希望这些结果将使其他研究人员受益,并激励他们进一步研究这个问题。
英文摘要:
In recent times, it has been shown that one can use code as data to aid various applications such as automatic commit message generation, automatic generation of pull request descriptions and automatic program repair. Take for instance the problem of commit message generation. Treating source code as a sequence of tokens, state of the art techniques generate commit messages using neural machine translation models. However, they tend to ignore the syntactic structure of programming languages. Previous work, i.e., code2seq has used structural information from Abstract Syntax Tree (AST) to represent source code and they use it to automatically generate method names. In this paper, we elaborate upon this state of the art approach and modify it to represent source code edits. We determine the effect of using such syntactic structure for the problem of classifying code edits. Inspired by the code2seq approach, we evaluate how using structural information from AST, i.e., paths between AST leaf nodes can help with the task of code edit classification on two datasets of fine-grained syntactic edits. Our experiments shows that attempts of adding syntactic structure does not result in any improvements over less sophisticated methods. The results suggest that techniques such as code2seq, while promising, have a long way to go before they can be generically applied to learning code edit representations. We hope that these results will benefit other researchers and inspire them to work further on this problem.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。