C++ Parser and C/C++ preprocessor

Roberto Raggi roberto at kdevelop.org
Mon Aug 22 23:56:03 UTC 2005


This week I've worked a bit on the KDevelop C++ parser. I'm going to submit a 
new version of the parser later today. The new version has a _completly_ new 
Visitor and an improved Abstract Syntax Tree. 

I've removed from the AST the backward pointers (AST::parent()) and the list 
of the child nodes (AST::children()). Finally we have a *typed* AST :-)

I'm pretty sure it will break a bit your changes(Per? John?), but it shouldn't 
be too hard to merge back your stuff. Anyway, the good news is that the 
parser uses about the 10% less of memory, it is a bit faster(it is about 10 
times faster than the KDevelop 3.x C++ parser), the AST for expressions is 
more detailed(I know Adam was crying for it :-) and writing a new `operation' 
using the tree-walker is a lot easier.

The other good news is I've started to rewrite the preprocessor from scratch. 
The new version of rpp is a lot faster(better?) than old one. The old 
preprocessor was hardcoded in the lexer and its implementation was awful :-) 
take a look at lexer.* in the KDevelop 3.x source code. I hope we can use the 
new prepressor to provides more features in KDevelop(things like `reorganize 
headers', check for dependencies, quick open integration, and so on..).

I have almost completed the new interfaces for background parsing and problem 
reporting. The Problem reporter is almost the same as the old one, but now 
I'm trying to use the Model/View classes I've wrote for KDevelop 4 together 
with Harald


ciao robe

PS: I'm sorry if I'm breaking your changes, but trust me it's for the best :-) 

More information about the KDevelop-devel mailing list