Patch for kdevelop-pg to persist the AST

Adam Treat treat at kde.org
Mon Aug 7 03:24:35 UTC 2006


Hi Jakob,

Here is a patch that adds a new visitor to the parser which allows persistent 
AST's.  It is called 'serializer'.  The visitor has two public static 
functions: read and write.  Everything else is made private.  

Currently, testing with the csharp parser, it serializes an AST where the 
source file was 44K to a 355K file.  This is an uncompressed binary file. 
When I compress it with gzip it goes down to 55K.

I think this exposes a bug in the C# grammar file too.

Line # 1089 of the grammar file has:
     
member variable declaration_type:

This variable differs with all the other variables and the generated 
serializer needs to comment out this one.

Jakob, I haven't been able to find a dumptree or something similar in 
kdevelop-pg that would allow me to test the serializer to see if I can get 
the same output from an AST read from the disk as I would from a newly 
created AST via the parser.  How do you test?  Is there a debug mode I should 
know about?

One more thing... this is all STL and standard lib.  I haven't used Qt.  
Another thing, it does not persist the token stream.  I guess we'll have to 
do this too.

How goes the generated codemodel that uses the AST as a datastore?  Does it 
require a binding pass?

Cheers,

Adam
-------------- next part --------------
A non-text attachment was scrubbed...
Name: persistent_ast.patch.bz2
Type: application/x-bzip2
Size: 8503 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20060806/1c2a0877/attachment.bin>


More information about the KDevelop-devel mailing list