Parsing C ++ is a very difficult task .
There was a Boost / Spirit framework, and a couple of years ago they made a game with the idea of implementing a C ++ parser , but it is far from complete .
By fully and correctly analyzing the ISO C ++, it is far from trivial, and in fact there was a lot of related effort. But this is a difficult task that is not easy to accomplish without rewriting the full compiler interface, understanding all the C ++ and preprocessor. A pre-processor implementation called the “wave” is available from Spirit people.
However, you can take a look at pigs / oink (based on elsa), which is a C ++ parser toolkit specifically designed for use in source code conversion, it is used by the Mozilla project to conduct large-scale static analysis of source code and automatic rewriting of code, the most interesting is that it not only supports most of C ++, but also the preprocessor itself
On the other hand, there really is one single solution available: an EDG interface that can be used for almost all C ++ related efforts.
Personally, I would like to test the pig pig kit for elsa, which is used by Mozilla, in addition, the FSF has now approved work on gcc plugins using the runtime library license, so I would assume that the situation will change soon, as soon as people can easily use the parser Ccc based on gcc for such purposes using binary plugins.
So, in a nutshell: if you want: EDG, if you need something free / open source now : else / oink are pretty promising, if you have the time, you might want to use gcc for your project.
Another option is for C cscout code only .
none Mar 13 '09 at 20:02 2009-03-13 20:02
source share