Forum: Ruby Parsing C/C++ in Ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A2784809909ef88591afd19126c83993?d=identicon&s=25 Sparky Mat (sparkymat)
on 2009-01-13 10:55
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.
F52a217f68b0d4db49ce2ceb06f79691?d=identicon&s=25 Alex Fenton (Guest)
on 2009-01-13 13:15
(Received via mailing list)
Sparky Mat wrote:
> 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
83ca41657a99b65d99889abe712ba5e2?d=identicon&s=25 Jason Roelofs (Guest)
on 2009-01-13 13:32
(Received via mailing list)
On Tue, Jan 13, 2009 at 7:14 AM, Alex Fenton <aff28@deleteme.cam.ac.uk>
wrote:
> I haven't used gcc-xml but it would seem to me the right tool for the job.
>
>

What problems are you having with GCC-XML?

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

Jason
This topic is locked and can not be replied to.