语法和语义结合的代码补全方法
作者:
作者单位:

作者简介:

付善庆(1996-),男,硕士,主要研究领域为代码推荐,代码补全;赵瑞莲(1964-),女,博士,教授,博士生导师,CCF高级会员,主要研究领域为软件测试,软件可靠性分析;李征(1974-),男,博士,教授,博士生导师,CCF高级会员,主要研究领域为智能化软件工程,大规模程序源代码的分析与测试;郭俊霞(1977-),女,博士,副教授,CCF高级会员,主要研究领域为网络用户行为分析,网络应用程序测试.

通讯作者:

郭俊霞,E-mail:gjxia@mail.buct.edu.cn

中图分类号:

TP311

基金项目:

国家自然科学基金(61702029,61672085,61872026)


Code Completion Approach Based on Combination of Syntax and Semantics
Author:
Affiliation:

Fund Project:

National Natural Science Foundation of China (61702029, 61672085, 61872026)

  • 摘要
  • |
  • 图/表
  • |
  • 访问统计
  • |
  • 参考文献
  • |
  • 相似文献
  • |
  • 引证文献
  • |
  • 资源附件
  • |
  • 文章评论
    摘要:

    在软件工程领域,代码补全是集成开发环境(integrated development environment,IDE)中最有用的技术之一,提高了软件开发效率,成为了加速现代软件开发的重要技术.通过代码补全技术进行类名、方法名、关键字等预测,在一定程度上提高了代码规范,降低了编程人员的工作强度.近年来,人工智能技术的发展促进了代码补全技术的发展.总体来说,智能代码补全技术利用源代码训练深度学习网络,从语料库学习代码特征,根据待补全位置的上下文代码特征进行推荐和预测.现有的代码特征表征方式大多基于程序语法,没有反映出程序的语义信息.同时,目前使用到的网络结构在面对长代码序列时,解决长距离依赖问题的能力依旧不足.因此,提出了基于程序控制依赖关系和语法信息结合共同表征代码的方法,并将代码补全问题作为一个基于时间卷积网络(time convolution network,TCN)的抽象语法树(abstract grammar tree,AST)节点预测问题,使得网络模型可以更好地学习程序的语法和语义信息,并且可以捕获更长范围的依赖关系.实验结果表明,该方法比现有方法的准确率提高了约2.8%.

    Abstract:

    In the field of software engineering, code completion is one of the most useful technologies in the integrated development environment (IDE). It improves the efficiency of software development and becomes an important technology to accelerate the development of modern software. Prediction of class names, method names, keywords, and so on, through code completion technology, to a certain extent, improves code specifications and reduces the work intensity of programmers. In recent years, the development of artificial intelligence promotes the development of code completion. In general, smart code completion uses the source code training network to learn code characteristics from the corpus, and makes recommendations and predictions based on the context code characteristics of the locations to be completed. Most of the existing code feature representations are based on program grammar and do not reflect the semantic information of the program. The network structure currently used is still not capable of solving long-distance dependency problems when facing long code sequences. Therefore, this study proposes a method to characterize codes based on program control dependency and grammar information, and considers code completion as an abstract grammar tree (AST) node prediction problem based on time convolution network (TCN). This network models can learn the grammar and semantic information of the program better, and can capture longer-range of dependencies. This method has been proven to be about 2.8% more accurate than existing methods.

    参考文献
    相似文献
    引证文献
引用本文

付善庆,李征,赵瑞莲,郭俊霞.语法和语义结合的代码补全方法.软件学报,2022,33(11):3930-3943

复制
分享
文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:2020-11-08
  • 最后修改日期:2020-12-15
  • 录用日期:
  • 在线发布日期: 2021-04-21
  • 出版日期: 2022-11-06
您是第位访问者
版权所有:中国科学院软件研究所 京ICP备05046678号-3
地址:北京市海淀区中关村南四街4号,邮政编码:100190
电话:010-62562563 传真:010-62562533 Email:jos@iscas.ac.cn
技术支持:北京勤云科技发展有限公司

京公网安备 11040202500063号