I am a student and as part of my training I have the task of searching for clones of the source code in a certain C project.
It is not necessary to build a tree for the entire project, it is assumed that there are some source fragments, the clones of which need to be found, i.e. in essence, I only need to build trees for some arbitrary source code fragments, and then compare them, given that some subtrees may differ.
I have already written in my time the search for clones using the parameterization of some lexemes in fragments, now we need to move on to a comparison of these arbitrary fragments, like trees, since This allows you to find more clones.
I myself googled, but decided that it is reasonable to ask advice from more experienced people. Are there any means (preferably free) that will allow you to build syntactic trees for arbitrary fragments of C source code and that can produce a result in at least some text format to standard output or to a file so that the program I write can read it ?
Or some libraries for C ++, with which I can get an idea of ​​the arbitrary fragments mentioned inside my program?