C++ parser library?
I'm looking for a way to parse C++ in order to make a code analyzer (the end product will issue a series of warnings and errors that a compiler would miss).
Does anyone know of a C++ parser library that could help me to accomplish this?
Beware, C++ cannot be parsed by a context-free grammar. Simply parsing the syntax will not give you enough meaningful information that you can do better than a compiler at finding code problems. Just to parse C++ properly you have to perform semantic analysis.
Quote:Original post by nmi
How about this one:
http://www.gccxml.org/HTML/Index.html
Excellent, that's just the kind of thing I was looking for. No template support, but a good starting point.
A full C++ parsing engine with complete name and type resolution
is available from
http://www.semanticdesigns.com/Products/FrontEnds/CppFrontEnd.html
You can customize it to enable arbitrary checks, and therefore
produce your "warnings and errors a compiler would miss".
Which warning and errors are you considering?
-- IDB
is available from
http://www.semanticdesigns.com/Products/FrontEnds/CppFrontEnd.html
You can customize it to enable arbitrary checks, and therefore
produce your "warnings and errors a compiler would miss".
Which warning and errors are you considering?
-- IDB
Quote:Original post by Wixner
boost::spirit might work
http://www.boost.org/libs/spirit/index.html
As already suggested, boost::spirit lacks currently support for some features required to properly parse C++ without hackish workarounds.
However, if you check out the Google Summer of Code pages, you will see that boost is a SoC mentor organization, and on their "project ideas" page there is a proposal for a C++ parser implementation using the Boost/Spirit libraries.
This sounds like an interesting and challenging project, so if anybody here is an eligible student, you may want to consider checking it out.
http://code.google.com/soc/boost/about.html
Now what would really be cool is to use that code-parser to make
an 'header optimization-tool, moving headers from .h's to .cpp's
and using forward declaration where possible'...
Ah, going through that manually just plain sucks lol :)
an 'header optimization-tool, moving headers from .h's to .cpp's
and using forward declaration where possible'...
Ah, going through that manually just plain sucks lol :)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement