|
||||
Exact Clone Detection on ASTs/DAGs1. Parse Source files into Abstract SyntaxTrees (DAGs)2. For each subtree, hash into a bucket3. For each subtree i:If node i marked as subclone, mark i`s children as subclonesIf node i marked as clone, done with iFor each subtree j?i in same bucket as iif EqualTrees(i,j) // can stop on clone children having same clone masterMark i as (master) clone of i; mark j as clone of iMark children(i), children(j) as subclones4. For each subtree i:if node(i) marked as clone and node(i) not marked as subclonePrint �Node �,i,� is a clone�, Node(i)Improvements over Source Line method:Language parser automatically ignores blanks, comments, linebreaksLanguage name resolution (DAG) not confused by identical identifiersDAG version can unify near-misses written using different namesCan be extended to handle near-misses as parametersCan be extended to handle simple commutative operationsIntegrated into DMS, which can manage detected clones
|
||||
|
Comments or questions: [email protected] |
|||