use Devel::ParseXS; my $parser = Devel::ParseXS->new(); $parser->parse_file( $file ); my $ast = $parser->tree;
I have a need to manipulate XS files, and it'd be a lot easier to do so if one could parse them into an abstract format for further manipulation.
ExtUtils::ParseXS is a masterfully woven tapestry, but it because it weaves parsing, interpretation and code generation into a single pass, it's hard to use it to create an abstract representation.
This led me to develop Devel::ParseXS and it's companion modules in the Devel::XS::AST namespace. The parsing code closely follows the perlxs documentation, and where necessary I've used the existing behavior of ExtUtils::ParseXS to disambiguate a few things.
Currently the parsing is pretty complete; not everything is further translated into a useable AST object. Prior to releasing this to CPAN, I'd like to get some feedback on the module names.
Devel::ParseXS and Devel::XS::AST sound good to me.