Code completion and interative syntax (semantic) checking
zeitling at informatik.hu-berlin.de
Wed Jan 23 21:28:05 UTC 2002
On Wed, 23 Jan 2002, Thomas Schilling wrote:
> > Since I was using flex and bison at university I got fairly used to it. So
> > I'd really like to use it for something useful (we were to build an SQL
> > interpreter/compiler), but unfortunately exams will start soon. In March,
> > however, I may have some more time. But before I start, I have had a
> > couple thoughts about what could be done beyond code completion.
> me too ;-)
maybe that's because <see below>
> Dynamic syntax checking is hard. Because the C++-Syntax is extremely
> mad. (Many ambiguities and a LL(1) would hardly suffice.)
I don't quite agree. It all depends on how the error-token in bison is
used. With a smart part on that side LALR(1) (which is what bision uses
(its a subset of LR(1))
> > Since this would be some extremely useful not only for c, but also for
> > Makefiles, html, python: simply everything which follows syntatic rules,
> > it would be a pity to have it in kdevelop only.
> exa is working on making a library out of sourcenav (a code browsing
> tool by RedHat) but I'm afraid it wouldn't be that useful for CC.
> > Would Kate (KTextEditor) be the right place. I think this is the text
> > editor interface for gideon as well, right?
> I would find it best to have it in an independent library so also non-Qt/KDE
> tools can use it.
that doesn't contradict. We may do a seperate library but for KDE to be
useful, there should be KTextEditor interface for that library. And _them_
Gideon uses KTextEditor. That's much rather how it fits together.
> > Either a new interface would have to be designed or the text highlightling
> > interface to be extended.
> We have CppSupportPart (see gideon: parts/cppsuppoert )
I don't have an overview of the architecture. It should be generic enough
to support other languages as well. And so should our library.
> > Does anybody know how this would be done the right way (tm)? Or if there
> > are similar ideas in the Kate team?
> I once started the approach to have a two-component CC:
> part one is the parser that builds up a tree and
> part two analyses an expression to find out it's type
Yes. That's how I did the parser at university as well.
The first level consists of syntax checking only. It's got the advantage
that semantic errors don't cause an error yet. That's done in part two,
the semantic check. Some setup are performed in the first step, however.
> Both could be done in bison if you can avoid any errors (otherwise it would
> be very hard to ignore them).
you may have errors in certain parts of the tree and the rest can still be
OK. You just have to mark it as an error to be handled consistendtly.
> > Thinking about the implementation I think it would be best to have the
> > whole parse tree of the last few files opened in memory so that typing a
> > letter there would simply cause the affected parts of the tree to be
> > updated, which would save lots of time.
> That's for sure.
... but requires careful design.
> > Does anybody know wheater any of those features exist in any open source
> > IDE that we may copy from?
> I found none.
Ok. We should ask the Gnome guys if they are interested in such a library
as well. If it's independent they probably won't say no just because we're
"the bad guys".
> If you'd like to help us or just to get some more insight into my
> considerations you can simply send me a mail.
I prefer the mailing list. More people more ideas.
> (I even speak german ;-)
I don't really care. Actually for cs stuff I prefer plain English, because
I don't have to translate all the technical terms. After all which sounds
- "hacking code completion for Gideon" or
- "code completion für kdevelop hacken" ?
> P.S.: How is studying informatik at hu-berlin?
Me too! (I'm in Adlerfhof tomorrow from 15h onwards)
gregor at zeitlinger.de
More information about the KDevelop-devel