arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2409.06176cs.SE
收藏

多语言代码克隆检测器的开发与基准测试

Development and Benchmarking of Multilingual Code Clone Detector

Wenqing Zhu, Norihiro Yoshida, Toshihiro Kamiya, Eunjong Choi, Hiroaki Takada

AI总结:

针对现有代码克隆检测器语言可扩展性不足的问题,提出基于ANTLR的多语言代码块提取方法并实现MSCCD检测器,构建首个多语言克隆评估基准,验证其在性能与语言扩展性上的均衡性。

摘要:

编程语言的多样性日益增长,使得代码克隆检测器的语言可扩展性变得至关重要。然而,这对大多数现有克隆检测器而言颇具挑战,因为需要修改源代码处理器,而这需要具备目标语言的专家级知识且耗时耗力。多语言代码克隆检测器仅需提供目标语言的语法信息,便可更轻松地添加新语言支持。为解决现有多语言检测器在语言可扩展性与检测性能方面的不足,我们提出了一种基于ANTLR解析器生成的多语言代码块提取方法,并实现了一款多语言代码克隆检测器MSCCD,它支持的语言数量为目前现有检测器中最多,且具备检测Type-3代码克隆的能力。我们遵循以往研究的方法体系,针对Java语言评估了其检测性能。与10款最先进的检测器相比,MSCCD的检测性能处于平均水平,但支持的语言数量显著更多。此外,我们基于CodeNet数据库提出了首个多语言语法代码克隆评估基准。我们的研究结果表明,即便采用相同的检测方法,检测性能也会因所研究的源代码语言不同而存在显著差异。总体而言,在综合考虑检测性能与语言可扩展性时,MSCCD是所有受评估工具中最为均衡的一款。

英文摘要:

The diversity of programming languages is growing, making the language extensibility of code clone detectors crucial. However, this is challenging for most existing clone detection detectors because the source code handler needs modifications, which require specialist-level knowledge of the targeted language and is time-consuming. Multilingual code clone detectors make it easier to add new language support by providing syntax information of the target language only. To address the shortcomings of existing multilingual detectors for language scalability and detection performance, we propose a multilingual code block extraction method based on ANTLR parser generation, and implement a multilingual code clone detector (MSCCD), which supports the most significant number of languages currently available and has the ability to detect Type-3 code clones. We follow the methodology of previous studies to evaluate the detection performance of the Java language. Compared to ten state-of-the-art detectors, MSCCD performs at an average level while it also supports a significantly larger number of languages. Furthermore, we propose the first multilingual syntactic code clone evaluation benchmark based on the CodeNet database. Our results reveal that even when applying the same detection approach, performance can vary markedly depending on the language of the source code under investigation. Overall, MSCCD is the most balanced one among the evaluated tools when considering detection performance and language extensibility.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑