Python code for parsing and checking C ++

Is there a library for Python that will allow me to parse C ++ code?

For example, let's say I want to parse some C ++ code and find the names of all classes and their member functions / variables.

I can come up with several ways to hack it together with regular expressions, but if there is an existing library, it will be more useful.

+5
source share
5 answers

In the past, I used gccxml for this purpose (a C ++ parser that emits easily processed XML) - I hacked into my own Python interfaces, but now there is pygccxml that should pack well for you.

+7

++ - , . ++, . , ; , - Python.

DMS ++ Front End. , . , , .

, GCCXML, , , , , . GCCXML , .

+4

This is a bit outside the scope of your question, maybe ... but depending on what you are trying to achieve, maybe the Exuberant Ctags is worth a look.

+1
source

I have not tried it, but using the Python bundles from LLVM, the Clang parser can work; see here .

+1
source

What about pyparsing ?

0
source

All Articles