Incremental compilation in IDEs

A

amitdev

Hi,

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?
Any pointers would be appreciated.
 
C

Chris Smith

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.
 
M

Mike Schilling

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.
 
A

amitdev

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top