Q:

how to extract function definition from c source file

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

A:

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.

