Possible Duplicate:
How to create a plagiarism detector of c++ files
a simple lexer.cpp to convert a simle c++ file to a sequence of tokens
hi i have a project "plagiarism detector for c++ files"
and a need to know how to convert a c++ file to sequence of tokens like that :
int factorial(int n) {
if (n == 0) return 1 ;
else return n * factorial(n-1) ;
}
into that :
Int, factorial, (, int, n, ), {, if, (, n, ==, 0, ), return, 1, ;, else, return, n, *, factorial, (, n, -, 1, ), ;, }