Parsing C header files

W

Wayne

I was wondering if there is a tool that can parse a C header file and
give me an AST that would allow me to process it in Ruby. Does anyone
know of a relatively easy way to do this? I was thinking that a lot
of people probably need to parse API's for one reason or another.

My situation is that we have a large application that was originally
written in Ada, but now has a C interface. We need to make the API
available to Matlab/Simulink, which is a model-based development
system (basically it's programming with diagrams). This is done in
Matlab via S-functions (system functions). This system is pretty
large and writing all the S-functions by hand would be a big job.
Seems to me that a tool is the best choice and Ruby seems like the
tool to do it.
 
E

Eric Hodel

I was wondering if there is a tool that can parse a C header file and
give me an AST that would allow me to process it in Ruby. Does anyone
know of a relatively easy way to do this? I was thinking that a lot
of people probably need to parse API's for one reason or another.

My situation is that we have a large application that was originally
written in Ada, but now has a C interface. We need to make the API
available to Matlab/Simulink, which is a model-based development
system (basically it's programming with diagrams). This is done in
Matlab via S-functions (system functions). This system is pretty
large and writing all the S-functions by hand would be a big job.
Seems to me that a tool is the best choice and Ruby seems like the
tool to do it.

Take a look at h2rb in ext/dl/ in a ruby checkout/tarball.
 

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

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top