Source Code Similarity Detection
Source Code Similarity Detection
diploma thesis (DEFENDED)
![Document thumbnail](/bitstream/handle/20.500.11956/18910/thumbnail.png?sequence=7&isAllowed=y)
View/ Open
Permanent link
http://hdl.handle.net/20.500.11956/18910Identifiers
Study Information System: 41205
Collections
- Kvalifikační práce [11266]
Author
Advisor
Referee
Parízek, Pavel
Faculty / Institute
Faculty of Mathematics and Physics
Discipline
Software systems
Department
Department of Software Engineering
Date of defense
2. 2. 2009
Publisher
Univerzita Karlova, Matematicko-fyzikální fakultaLanguage
English
Grade
Very good
Cílem této diplomové práce je návrh a vývoj nástroje použitelného pro detekci podobných zdrojových kódů v různých projektech. Nástroj by měl být schopný nalézt kód zkopírovaný z jednoho projektu do druhého a měl by si poradit s běžnými pokusy o zmaření nalezení, jakými je například přejmenování symbolů, změna na sobě nezávislých entit, přesunutí entit do jiných souborů, přidání či odebrání komentářů, apod. Nástroj je implementován v jazyce C++ a připraven pro porovnávání zdrojových kódů v jazycích C a C++. Nástroj umožňuje i porovnávání zdrojových kódů v jiných jazycích, které je možné překládat pomocí kompilátoru GNU C Compiler. Pro kvalitní použití nástroje na takové zdrojové kódy je však potřeba připravit přídavné moduly (to je dáno odlišnou vnitřní formou překladače GNU C Compiler pro různé překládané jazyky). První část diplomové práce se zaměřuje na popis problému, návrh architektury a nástroje, které je možné využít při vývoji. Druhá část je zaměřena na vlastní aplikaci, popis použitých datových struktur a možnosti rozšíření aplikace přidáváním modulů. Poslední část diplomové práce popisuje dosažené výsledky a další směry, které je možné v aplikaci rozvíjet.
The objective of this thesis is to design and implement a tool usable for detecting similar code in different projects. The tool should be able to locate code pasted from one project to another and should be able to cope with average attempts to thwart the detection such as symbol renaming, changing the order of unrelated entities, moving entities to different files, adding or removing comments, etc. The tool is implemented in language C++ and is ready to compare source files written in languages C and C++. The tool also enables the comparison of source code written in different languages, which can be compiled by the GNU C Compiler. To obtain good results in these cases, new modules should be added (this is necessitated due to different representations of the GNU C Compiler inner form for different languages). The first part of this thesis focuses on describing the problem domain, the architecture design and the tools usable for implementation. The second part centers on the implemented solution, a description of data structures and possibilities for application expansion using additional modules. The last part of the thesis sums up the results and outlines future possibilities of implementation.