tom_usenet said:
There are various projects to write C++ parsers for use in, e.g., code
refactoring. But as you say, the problem is an order of magnitude or
two larger that for much simpler languages like Java.
Eclipse has a built in C++ parser, but I expect it will take a long
time before it is anything like as reliable as the Java one.
Tom
Now, suppose you had a way to represent a C++ program in XML. I know. The
very thought sounds hideous. I will suggest anybody who wants to reject
this idea out-of-hand, take a look at MathML. But even that suggests
something far more painful to look at than what I am suggesting.
Consider that XML is a descendant of SGML which was created to semantically
markup text for electronic processing. The Document Object Model (DOM) is
ostensibly just that, an object model to represent a document. It seems
reasonable in my mind to consider a source file and/or translation unit a
document.
The DOM is intended to support validity checking against some kind of
document definition, be that a DTD, XMLSchema, or other form of document
specification. I believe any properly formed C++ translation unit will be
representable as a tree graph, and thus conform to a DOM representation.
I've spent a good deal of time with the DOM specifications
http://www.w3.org/DOM/ and firmly believe this is, in principle a
reasonable approach to constructing an IDE buffer. There are many powerful
features built into the DOM which would probably be very useful in editing
and manipulating a program.
Why am I saying this here in this newsgroup? Because I think it is
potentially valuable to C++, and i would like to see someone pick it up and
run with it.
The piece I think needs to be created first is the schema representation of
C++ to validate a document against.