Choosing the right parser for parsing C headers

Paddy McCarthy paddy3118x at netscape.net
Tue Feb 8 14:58:33 EST 2005


Jean de Largentaye wrote:
> Hi,
> 
> I need to parse a subset of C (a header file), and generate some unit
> tests for the functions listed in it. I thus need to parse the code,
> then rewrite function calls with wrong parameters. What I call "shaking
> the broken tree" :)
> I chose to make my UT-generator in Python 2.4. However, I am now
> encountering problems in choosing the right parser for the job. I
> struggle in choosing between the inappropriate, the out-of-date, the
> alpha, or the too-big-for-the task...

Why not see if the output from a tags file generator such as ctags or 
etags will do what you want.

I often find that some simpler tools do 95% of the work and it is easier 
to treat the other five percent as broken-input.

try http://ctags.sourceforge.net/


- Paddy.



More information about the Python-list mailing list