Ruby / Python - C / C ++ Code Generation and Parsing

I need to generate C-structures and arrays from the data stored in the db table and parse this information one by one. I use both ruby ​​and python for this task, and wondered if anyone had heard of the / lib module that handles this for both languages? I could do this on my own using some string processing, but I wanted to check if there is a well-known and verified parser that people know about. thank.

+3
source share
3 answers

Check out the open source SWIG software (Simplified Wrapper and Interface Generator). The first suggestion for joining a web page:

SWIG is a software development tool that connects programs written in C and C ++ with many high-level programming languages. SWIG is used with various types of languages ​​including common scripting languages ​​such as Perl, PHP, Python, Tcl, and Ruby.

Very mature (the initial release is February 1996 according to Wikipedia), and there are many textbooks, documentation, and help.

+3
source

- pyparsing C struct . Pyparsing - Python , . ( Ruby- .)

+1

Didn't use it myself, but CAST might be worth a look:

http://cast.rubyforge.org/

+1
source

Source: https://habr.com/ru/post/1767732/


All Articles