c++ code completion status report
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Wed Jan 9 15:29:04 UTC 2002
On Tuesday 08 January 2002 3:07 pm, Gregor Zeitlinger wrote:
> (for the gcc mailing list)
> I thought this might be interesting to you...
>
> On Mon, 7 Jan 2002, Richard Dale wrote:
> > But one the other hand, I like the idea of using the gcc 3.0.x
> > preprocessor, tokenizer and bison grammar code as a starting point in
> > 'advancedcpp'. Then gideon would become a sort of 'Visual gcc'. It isn't
> > that your grammar would be any better or worse than the gcc one, but
> > actually using the same code from gcc for class browsing and code
> > completion etc. would be new in an IDE I believe.
>
> Right. I think this can be the only preferred way (tm), because it's the
> only way to make vgcc behave like gcc.
>
> I'd even go further: Why parsing the files over and over to do code
> completion instead of doing an incremental parse, that is to say: look
> what changed and change the internal representation of the c code
> accordingly. That way code completion code be sped up from maybe 30
> seconds to about one. I reckon, however, that this is much more complex.
Because if the code completion parsing is only done on demand when the user
presses a certain function key after typing 'foobar->' or similar, the
0.5s/3000 lines overhead while the code completion widget comes up isn't too
important. I don't think parsing a single source file will ever take 30s, so
that isn't a problem (the whole of a large project will take this time, and
that's where the persistant class store will help).
> Maybe we'd be able to use the internal representation of gcc, or access it
> through a well defined interface to avoid having to struggle with bison,
> flex and the c preprocessor at all. If we adopted that approach, the
> incremental parsing would become a feature of gcc and other IDE's would be
> able to use it as well.
But the internal representation is the only bit we don't need! I think the gcc
bison grammar is 'hackable' without fear of failure (ie 'struggle'),
especially with more than one person doing it. For me, I'd have to wait for a
good day and get in 'serious parser dude mode', read bison manuals etc..
> Anyways... I just added the gcc mailing list, to hear their opinions on
> the topic. Maybe the problem is already solved :)
Yes, I'd be interested in hearing how the gcc parsing code has been put to any
other uses too.
-- Richard
More information about the KDevelop-devel
mailing list