-1

Basically, my requirement is to parse multiple C files (with their respective headers) into a single AST.

AST should have following information:

  1. Call graph (which function is called from where).
  2. Function names and variables.

Is such a thing possible?

unwind
  • 391,730
  • 64
  • 469
  • 606
Avi
  • 71
  • 5
  • Do You need the AST or just a call graph? Maybe this question helps You: https://stackoverflow.com/questions/8887810/how-to-get-doxygen-to-produce-call-caller-graphs-for-c-functions – Roman Hocke Jun 13 '17 at 09:04
  • I need the AST, which will have the call graph information. May be for now can you point to some tool which just generates a AST for multiple C files. – Avi Jun 13 '17 at 09:16
  • 1
    Maybe you can find something useful here: https://stackoverflow.com/questions/20250702/build-ast-from-c-code – Roman Hocke Jun 13 '17 at 09:19

1 Answers1

0

Yes, of course that's possible.

You're going to have to be a bit more particular in defining the set of files to parse, and it's probably going to be a bit annoying to deal with multiple symbols of the same name but different meaning in different files, but of course those problems are solvable.

Recommending existing tools, however, is off topic for this site.

unwind
  • 391,730
  • 64
  • 469
  • 606
  • Can you please point to some existing tools that can do it? Or tools that capable of doing it with some enhancements. I know of a tool called pycparser, but I think it parses only a single C file. – Avi Jun 13 '17 at 08:40