Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-10-14 15:20:02


----- Original Message -----
From: "Prabhu Ramachandran" <prabhu_at_[hidden]>

> Now to something more concrete. About this C++ parser. What exactly
> do you want? I really dont know much about this kind of stuff. Would
> it be possible to create a c++ parser in python or does it have to be
> in c++? Python would be the easiest to code, right?

Well, maybe, but there are surely many existing parsers out there already in
C/C++ using YACC and BISON. I think you'll find a BISON-based parser in the
Doxygen sources.

> If it is not
> that hard maybe I can take a shot at it and brush up my re. Or is
> this thing non-trivial?

Heh, heh. Regular expressions alone aren't going to cut it. You need
something that can deal with a CFG (e.g. balanced parentheses are not
parseable with REs). The big problem is that in addition to parsing,
significant semantic analysis is also neccessary: I'd need at least enough
to understand all of the type declarations. This is what ILU and SWIG and
all other similar systems try to do, and it's no coincidence that they all
seem to fail on certain kinds of code: it's a hard job to do right. Given
the current complexity of the C++ template type system (the /compiler/
itself is a complete functional language) I'd bet that a complete solution
would replicate the majority of all front-end functionality found in a full
C++ compiler.

maybe-now-you-see-why-I'm-not-making-any-promises-ly y'rs,
dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk