Plagiarism checks for source code In one of my answers I elaborated on the way we do language-tailored plagiarism checks on student submissions:


  The general idea is to strip comments, whitespace, variable and function names, literals, and thus only keep the general structure of a program, i.e. parentheses, curly braces, semicolons, etc. (for C-like, that is). Then compare this 'hash' for all hand-ins, and when you find a match manually check if the programs look alike. For example, the hash of the program below would be something like #&lt;&gt;(,*){(;;--){("",);}}:

#include &lt;stdio.h&gt;
void repeat(int n, char *word) {
    for (; n; n--) {
        printf("%s\n", word);
    }
}



While this model has proven successful in the past, there are a few obvious ways to escape these plagiarism checks:


Moving functions around
Changing parameter order
Omitting / using { and } around single-line blocks


Fortunately, these are not the things most students think about (usually, they rename functions and variables / include comments). However, I am interested in improving this model or using something that already exists which would tackle these issues above as well - not only because I want to be able to detect plagiarism but also because I find this an interesting problem.

In particular, I am thinking about a system that would actually parse the programs and compare the abstract syntax trees for similarities. Does any such system exist?
I have been responsible for using performing and evaluating tools for detecting software plagiarism in my academic department.

There are several published review articles in the scholarly journals. One such report Culwin, MacLeod &amp; Lancaster, 2001, UK JISC, "Source Code Plagiarism in UK HE
Computing Schools,
Issues, Attitudes and Tools" gives an overview. 

Basically, there are published algorithms and methodologies you could implement yourself, open source software you can run locally, or an internet based service you can register and use.

One such tool that you can run locally is JPLAG from the University of Karlsruhe in Germany. This has several language syntax implemented, and as it is open source you can amend as desired.

The best online tool is MOSS from Stanford which is the one I ended up using. 

If you wanted to research the various published techniques for detection, Google Scholar is a good source.