SPUG: Parsing (or at least matching) C function prototypes

Damian Conway damian at conway.org
Mon Mar 1 20:02:16 PST 2010


> In order to create an instrumentation layer in his C code, a friend wants to
> extract function prototypes from his C code.

Parse::RecDescent isn't purely regex (and isn't especially fast), but
it does come
with:

    http://search.cpan.org/~dconway/Parse-RecDescent-1.964/demo/demo_another_Cgrammar.pl

which does a pretty solid job.

Your friend might also like to look at the source code of Inline::C,
in particular:

    http://cpansearch.perl.org/src/SISYPHUS/Inline-0.46/C/lib/Inline/C/ParseRegExp.pm

or:

    http://cpansearch.perl.org/src/SISYPHUS/Inline-0.46/C/lib/Inline/C/ParseRecDescent.pm

Damian


More information about the spug-list mailing list