An algo for generating code callgraphs

Posted by Shrey on Stack Overflow See other posts from Stack Overflow or by Shrey
Published on 2010-06-18T14:11:33Z Indexed on 2010/06/18 14:23 UTC
Read the original article Hit count: 251

Filed under:
|
|

I am working on a project which requires generating some metrices of a code (it can be C/C++/Java/Python). One of the metrices can be that I create a callgraph after parsing the code entered (the programs are expected to be small - probably under 1000L).

As of now, I am looking for a way to create a program (it can be C/Python) which can take as input a file (C/C++/Python/Java) and then create a textual output containing approximate calling sequence as well as tokens in the code file.

As of now, I have looked at some other tools which do the same thing - like splint, pylint, codeviz etc. So, I have two ways of solving my problem:

  1. Read and understand the algorithm these tools use (tokenization->graph generation etc)
  2. Or, have a basic algo (something like very high level steps) and then sit down to create each of them as I want them to be.

I know, re-inventing the wheel is not a good idea, but, I would still like to give option (2) a shot. Only issue is, currently I am a blank.

My question: Does any one have any knowhow about how to create code graphs? Any hints as to what I should do? Any top levels steps which I can follow?

Thanks a lot.

© Stack Overflow or respective owner

Related posts about python

Related posts about c