### 3.      The basic functionality: It should be able to discover exact clones of some length, say 3, that you can specify in your program or pass as an input. We will not worry about counting how many copies are there, just any 2 similar fragments of the code that are of the same length are going to be reported. For example, the code below may result in discovering 3 clones, which are the 1st with the 2nd, the 1st with the 3rd and the 2nd with the 3rd. If you can do better and avoid this by reporting that there are 3 copies of the same fragment, this is better.

x:=x+1;  % First Copy
y:=y+1;
:
x:=x+1;  % Second
y:=y+1;
:
x:=x+1;  % Third
y:=y+1;
:

### ·          Omitting labels: Omit labels and discover clones without labels, that would not be discovered otherwise. For example, your program should be able to discover that these two fragments are the same without labels.

SomeLabel: x:=x+1;  % First Copy
y:=y+1;
:
OtherLabel:x:=x+1;  % First Copy
y:=y+1;
:

### ·          Discover near clones with similar assignment statements if the left hand side is the same. For example, your program should be able to discover that these two fragments are similar.

x:=x+1;  % First Copy
y:=y+1;
if x>0 then goto b;
:
x:=z;    % Second
y:=y+1;
if x>0 then goto b;

### ·          Discover exact clones even those within loops or if statements. For example, your program should be able to discover that the two bold underlined fragments are similar.

z:=x-1;
x:=x+1;
y:=y-1;
a: if x>0 then goto b;
z:=x-1;
x:=x+1;
y:=y-1;
m: if y>0 then goto n;
o:=y;
goto m;
endif
n:  goto a;
endif
b: x:=99;

### Resources:

q       Amble Resources are found on the TXL page