A AST and context based duplicated code detecting method

Wei Liu, Chuanchang Liu, Yunzhan Gong, Junliang Chen · China-Ireland International Conference on Information and Communications Technologies (CIICT 2008) · 2008

This paper presents a duplicated code detecting method based on AST (Abstract Syntax Tree) and context, and designs a flexible rule-based parameterized matching method which is able to locate the consecutive duplicated code by applying the string matching algorithm to some special kinds of AST nodes. Then, the method calculates the searching distance according to the variable' association between code lines in the context to detect the nonconsecutive duplicated code. Both the time complexity and the space complexity of the method are O(N). The experiment results prove that the method can detect nonconsecutive duplicated codes.

Read the paper · More papers on PaperTik