Parsing C/C++ in Ruby

S

Sparky Mat

I need to parse a source tree to generate a table of functions used.
GCC-XML is causing more trouble than helping (I might be using it
wrong). Is there a C/C++ parser library (written in Ruby) available?
Failing which, which parser generator would you recommend, that would
help me write a simple C parser? My CC skills are a bit rusted, and it
would greatly help if the parser generator library has examples and/or
tutorials.
 
A

Alex Fenton

Sparky said:
I need to parse a source tree to generate a table of functions used.
GCC-XML is causing more trouble than helping (I might be using it
wrong). Is there a C/C++ parser library (written in Ruby) available?
Failing which, which parser generator would you recommend, that would
help me write a simple C parser? My CC skills are a bit rusted, and it
would greatly help if the parser generator library has examples and/or
tutorials.

I haven't used gcc-xml but it would seem to me the right tool for the job.

As an alternative you could use SWIG, and output the results to xml (use
the -xml or -xmlout options). Then parse that XML with rexml or libxml.

C++ is a pretty complex language to parse, but SWIG understands most of
it - certainly enough to locate methods and functions.

a
 
J

Jason Roelofs

I haven't used gcc-xml but it would seem to me the right tool for the job.

As an alternative you could use SWIG, and output the results to xml (use the
-xml or -xmlout options). Then parse that XML with rexml or libxml.

C++ is a pretty complex language to parse, but SWIG understands most of it -
certainly enough to locate methods and functions.

a

What problems are you having with GCC-XML?

Have you checked out rbgccxml? http://github.com/jameskilton/rbgccxml

Jason
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top