> Any idea how the ide's do incremental ocmpilation as you type?
> Is it just running a background thread whenever the user makes a
> change and is idle?
I'm unsure exactly what you're looking for. Yes, most likely there is a
background thread there, and probably some synchronization using
wait/notify so that when the code is changed, the environment can run it
against the syntax and semantic checkers.
Not that in general, the IDE doesn't actually compile as you type. It
just runs the first few stages of the compiler -- lexical, syntactic,
and semantic analysis, and reports any errors. Eclipse, at least, also
stores the abstract syntax tree that results from the parser (syntactic
analysis), so that it can be used by various plug-ins to interact with
the source code at a higher level than plain text.

Signature
Chris Smith - Lead Software Developer / Technical Trainer
MindIQ Corporation
Mike Schilling - 05 Jun 2006 04:19 GMT
> Not that in general, the IDE doesn't actually compile as you type. It
> just runs the first few stages of the compiler -- lexical, syntactic,
> and semantic analysis, and reports any errors. Eclipse, at least, also
> stores the abstract syntax tree that results from the parser (syntactic
> analysis), so that it can be used by various plug-ins to interact with
> the source code at a higher level than plain text.
And note that an IDE [1] does this parsing in a way that's very tolerant of
errors. A class or method that's full of syntax errors is still a candidate
for code completion.
1. In particular, IntelliJ, though I'd be shocked if it were unique in this
respect.
amitdev@gmail.com - 08 Jun 2006 01:52 GMT
Thanks for your comments. Actually I cannot maintain any AST. Imagine
there is a
compiler which is a blackbox. I need to compile and highlight errors as
the user types.
I am planning to run a timer and periodically compile checking if the
user has changed
the text. The main question is when to run the compile. The timer will
be safer I guess
> > Any idea how the ide's do incremental ocmpilation as you type?
> > Is it just running a background thread whenever the user makes a
[quoted text clipped - 15 lines]
> Chris Smith - Lead Software Developer / Technical Trainer
> MindIQ Corporation