C parsing fun

Károly Kiripolszky karoly.kiripolszky at gmail.com
Mon Feb 5 08:11:07 EST 2007


Thx for responding, Szabolcs! I've already tried that, but couldn't
manage to get it to work. The source I tried to parse is a huge MSVC
7.1 solution containing about 38 projects, and I believe the code is
so complex that it has too many different dependencies and GCC just
can't handle them. Btw I'm not deeply familiar with C++ compilers, so
maybe it was because of compiler misconfiguration, but I really don't
know...

Szabolcs Nagy írta:
> > based on concepts my boss had. To do this I needed to represent C++
> > code structure in Python somehow. I read the docs for Yapps, pyparsing
> > and other stuff like those, then I came up with a very simple idea. I
> > realized that bracketed code is almost like a Python list, except I
> > have to replace curly brackets with squared ones and surround the
> > remaining stuff with quotes. This process invokes no recursion or node
>
> yes that's a nice solution
> sometimes it's not enough though (won't work on code obfuscated with
> macros)
>
> anyway if you need something more sophisticated then i'd recommend
> gccxml or it's python binding:
>
> http://www.language-binding.net/pygccxml/pygccxml.html




More information about the Python-list mailing list