[C++-sig] Re: Python: C++ parse tree tools?

David Abrahams dave at boost-consulting.com
Mon Dec 9 17:25:11 CET 2002


The following message is a courtesy copy of an article
that has been posted to gmane.comp.lib.boost.user as well.

srivatsan raghavan <machinshin2002 at yahoo.com> writes:

> --- "William Trenker <wtrenker at hotmail.com>"
> <wtrenker at hotmail.com> wrote:
>> Does anyone know if there is a GCC option to save
>> the C++ parse tree
>> to a file?  Or has anyone come across a C++ parser
>> utility that does
>> this?  I'm building a Python extension for a library
>> that has many
>> .hpp files and I would like to try and automate the
>> generation of the
>> Boost.Python headers for this library.
>> 
>> Thanks,
>> Bill
>
>
> yes, i know of one called gcc-xml.. i don't know if
> the project is still being worked on, 

It is. Brad King, the author, is also working on CABLE, an automated
wrapping system. He has been talking about building a GCC_XML
front-end for Boost.Python. There has also been interest more recently
from someone named Nicodemus on the C++-sig:
http://www.python.org/sigs/c++-sig/

> but basically it uses gcc's parser as a 1st phase and then takes the
> parse tree that's generated and outputs an xml file (i don't know if
> it has a schema or DTD available , it didn't when i last looked, but
> the xml format it uses is sufficiently simple that writing a
> DTD/schema should be trivially simple) url here :
> http://www.gccxml.org/HTML/Index.html
>
> last i checked it uses the gcc 3.0.4 source as the
> front end parser, so it may be a bit lacking in terms
> of advanced c++ features especially in the area of
> templates :) ( as was gcc in general until 'round 3.2
> anyway ) 
> but that should help you out :) 

GCC_XML is up to 3.2 now, and I have to disagree about GCC's template
handling before that. Even 2.95.2 was pretty great by comparison to
many of today's production compilers. The front-end in 3.0.4 was not
enormously different from 3.2 in its capabilities.

-- 
                       David Abrahams
   dave at boost-consulting.com * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution





More information about the Cplusplus-sig mailing list