I need to generate C structs and arrays from data stored in a db table, and alternately parse similar info. I use both ruby and python for this task, and was wondering if anyone heard of a module/lib that handles this for either/both languages? I could do this on my own with some string processing, but wanted to check if there's a known and tested parser out there that people know of. thanks.
Check out open-source software tool SWIG (Simplified Wrapper and Interface Generator). First sentence of the intro on the webpage:
SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages. SWIG is used with different types of languages including common scripting languages such as Perl, PHP, Python, Tcl and Ruby.
Very mature (initial release - February 1996 according to Wikipedia) and there are lots of tutorials, documentation, and help.
There is a basic C struct parser here on the pyparsing wiki. Pyparsing is a Python module for creating parsers by assembling separate parsing building blocks together. (No help on the Ruby part of the question, though.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With