A theory of parameterized pattern matching
Brenda S. Baker · 1993
This paper develops a theory and algoritbrns for an application problem arising in software maintenance.The application is to track down duplication in a large software system.We want to find not only exact matches between sections of code, but parametrized matches, where a parametrized match between two sections of code means that one section can be transformed into the other by replacing the parameter names (e.g.identifiers and constants) of one section by the parameter names of the other via a one-to-one function.This paper formalizes this problem in terms of parametrized strings and parametrized pattern matching and detirtes a new data structure (parametrized sujjfi.xtree) suitable for parametrized pattern matching.It gives efficient algorithms for constructing this data structure, efficient algorithms for parametrized pattern matchmg, and an efficient algorithm for timing all maximal parametrized matches over a threshold length in a parametrized string.The algorithms for constructing parametrized suffix trees and for reporting duplication over a threshold length have been implemented.Tests on C code indicate that these algorithms should perform well in the application.