I am working on a perl script that prints out the entire function onto std out given the source file name and function name. using a regex might not be feasible as i have multiline function prototypes. any suggestion on whether there are c parser perl modules which might be helpful here. logic on how can i handle nesting {}. help me out
Asked
Active
Viewed 711 times
-3
-
[What have you tried?](http://whathaveyoutried.com/) SO is not a write-some-code-for-me site. You'll have to try for yourself and when you're stuck somewhere then state your problem here and you'll get help. – dgw Dec 12 '14 at 08:54
-
I'll just leave a link to the [Clang module](http://search.cpan.org/~alexbio/Clang-0.06/lib/Clang.pm) on CPAN here. – Wintermute Dec 12 '14 at 09:02
-
Why not just use Cscope? – Slade Dec 13 '14 at 18:08
1 Answers
4
MarpaX::Languages::C::AST, powered by Marpa general BNF parser, parses a C file and gives you an AST with callbacks using which you can extract the function body/definition.

rns
- 771
- 4
- 9