基于ANTLR解析树编辑距离的代码克隆检测

Sanjay B. Ankali, L. Parthiban
{"title":"基于ANTLR解析树编辑距离的代码克隆检测","authors":"Sanjay B. Ankali, L. Parthiban","doi":"10.4018/ijsi.297915","DOIUrl":null,"url":null,"abstract":"In spite of significant research done in the past 3 decades introducing more than 250 clone detection tools/ techniques for finding the same language clones, there exists no single framework to detect and classify all 4 basic types of clones with great accuracy (precision and recall). In this paper, we propose an accurate and language agnostic technique to classify 4 types of clones. The method first generates an ANTLR parse tree for the input program file using freely available ANTLR grammar files then finds the edit distance between the two parse trees using the Levenshtein distance algorithm and converts the edit distance into similarity using. We obtained 100% precision and recall in detecting type 1 & 2 clone types and achieve 98.50 and 98.12 respectively for type 3 and 4 clone types for our datasets containing microprograms of C, CPP, and Java. This paper provides evidence that the Levenshtein distance on ANTLR parse tree is the good choice to build a complete and accurate software clone detector and act as proper validation tools to detect code plagiarism.","PeriodicalId":396598,"journal":{"name":"Int. J. Softw. Innov.","volume":"10 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2022-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Accurate and Language Agnostic Code Clone Detection by Measuring Edit Distance of ANTLR Parse Tree\",\"authors\":\"Sanjay B. Ankali, L. Parthiban\",\"doi\":\"10.4018/ijsi.297915\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"In spite of significant research done in the past 3 decades introducing more than 250 clone detection tools/ techniques for finding the same language clones, there exists no single framework to detect and classify all 4 basic types of clones with great accuracy (precision and recall). In this paper, we propose an accurate and language agnostic technique to classify 4 types of clones. The method first generates an ANTLR parse tree for the input program file using freely available ANTLR grammar files then finds the edit distance between the two parse trees using the Levenshtein distance algorithm and converts the edit distance into similarity using. We obtained 100% precision and recall in detecting type 1 & 2 clone types and achieve 98.50 and 98.12 respectively for type 3 and 4 clone types for our datasets containing microprograms of C, CPP, and Java. This paper provides evidence that the Levenshtein distance on ANTLR parse tree is the good choice to build a complete and accurate software clone detector and act as proper validation tools to detect code plagiarism.\",\"PeriodicalId\":396598,\"journal\":{\"name\":\"Int. J. Softw. Innov.\",\"volume\":\"10 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2022-01-01\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Int. J. Softw. Innov.\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.4018/ijsi.297915\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Int. J. Softw. Innov.","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.4018/ijsi.297915","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

摘要

尽管在过去的30年里进行了大量的研究,引入了250多种克隆检测工具/技术来寻找相同的语言克隆,但没有一个单一的框架可以非常准确地检测和分类所有4种基本类型的克隆(精度和召回率)。在本文中,我们提出了一种精确和语言不可知的技术来分类4种类型的克隆。该方法首先使用可免费获得的ANTLR语法文件为输入程序文件生成ANTLR解析树,然后使用Levenshtein距离算法查找两个解析树之间的编辑距离,并将编辑距离转换为相似度。在包含C、CPP和Java微程序的数据集上,我们检测1类和2类克隆类型的准确率和召回率达到100%,3类和4类克隆类型的检测准确率和召回率分别达到98.50和98.12。本文提供的证据表明,在ANTLR解析树上的Levenshtein距离是构建完整、准确的软件克隆检测器的良好选择,可以作为检测代码抄袭的适当验证工具。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
Accurate and Language Agnostic Code Clone Detection by Measuring Edit Distance of ANTLR Parse Tree
In spite of significant research done in the past 3 decades introducing more than 250 clone detection tools/ techniques for finding the same language clones, there exists no single framework to detect and classify all 4 basic types of clones with great accuracy (precision and recall). In this paper, we propose an accurate and language agnostic technique to classify 4 types of clones. The method first generates an ANTLR parse tree for the input program file using freely available ANTLR grammar files then finds the edit distance between the two parse trees using the Levenshtein distance algorithm and converts the edit distance into similarity using. We obtained 100% precision and recall in detecting type 1 & 2 clone types and achieve 98.50 and 98.12 respectively for type 3 and 4 clone types for our datasets containing microprograms of C, CPP, and Java. This paper provides evidence that the Levenshtein distance on ANTLR parse tree is the good choice to build a complete and accurate software clone detector and act as proper validation tools to detect code plagiarism.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信