HackerPapers

arXiv:2003.05615cs.SE

Code Clone Matching: A Practical and Effective Approach to Find Code Snippets

Katsuro Inoue, Yuya Miyamoto, Daniel M. German, Takashi Ishio

Early discovery. Linked by one identifiable commenter. This paper is outside the main ranking; a mention is not an endorsement.

Abstract

Finding the same or similar code snippets in source code is one of fundamental activities in software maintenance. Text-based pattern matching tools such as grep is frequently used for such purpose, but making proper queries for the expected result is not easy. Code clone detectors could be used but their features and result are generally excessive. In this paper, we propose Code Clone matching (CC matching for short) that employs a combination of token-based clone detection and meta-patterns enhanced with meta-tokens. The user simply gives a query code snippet possibly with a few meta-tokens and then gets the resulting snippets, forming type 1, 2, or 3 code clone pairs between the query and result. By using a code snippet with meta-tokens as the query, the resulting matches are well controlled by the users. CC matching has been implemented as a practical and efficient tool named ccgrep, with grep-like user interface. The evaluation shows that ccgrep~ is a very effective to find various kinds of code snippets.

arXiv comments
11 pages, for downloading ccgrep, https://github.com/yuy-m/CCGrep
Journal reference
DOI
Subjects
cs.SESoftware Engineering

On Hacker News

Linked by 1 identifiable commenter in 1 comment across 1 thread, from Aug 2021 to Aug 2021.

Comments linking this paper, per year.

Discussed in comments1 thread

    • I recently wrote a little Regex domain specific language that's translated into regular JavaScript regex. I was inspired by CCGrep: https://arxiv.org/abs/2003.05615 because its syntax looked so clean and yet powerful. Examples of it look like `$# ($a == $1) { return $$$; }` $#…

      elanningView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.