Parsing C++ to make some changes in the code

Viewed 389

I would like to write a small tool that takes a C++ program (a single .cpp file), finds the "main" function and adds 2 function calls to it, one in the beginning and one in the end.

How can this be done? Can I use g++'s parsing mechanism (or any other parser)?

5 Answers
Related