Skip to content
Related Articles

Related Articles

Incremental Compiler in Compiler Design

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 26 Aug, 2020

Incremental Compiler is a compiler that generates code for a statement, or group of statements, which is independent of the code generated for other statements.

Examples :
C/C++ GNU Compiler, Java eclipse platform, etc.

The Incremental Compiler is such a compilation scheme in which only modified source text gets recompiled and merged with previously compiled code to form a new target code. Thus incremental compiler avoid recompilation of the whole source code on some modification. Rather only modified portion of source program gets compiled.

Code           -->           Compilation
New code       -->           New Compilation 

(Previous                      (Previous Compilation + 
Code + Changes)                compilation of modified part)              

Need of Incremental Compiler :
Much of a programmer’s time is spent in an edit-compile-debug workflow as following.

  • you make a small change (often in a single module or even function).
  • you let the compiler translate the code into a binary, and finally.
  • you run the program or a bunch of unit tests in order to see results of the change.

This will increase the time of compilation at every step of change. But this can be overcome with the concept of incremental compiler (save the previous compilation and compile the modified part of the code).

How can this concept (concept of incremented compilation) be implemented :
We have already heard that computing something incrementally means updating only those parts of the computation’s output that need to be adapted in response to a given change in the computation’s inputs. One basic strategy we can employ to achieve this is to view one big computation (like compiling a program) as a composite of many smaller, interrelated computations that build upon each other. Each of those smaller computations will yield an intermediate result that can be cached and hopefully re-used in a later iteration, sparing us the need to re-compute that particular intermediate result again.

Features of incremental compiler :

  • During program development process modifications to Source program can cause recompilation of whole source text. This overhead is reduced in incremental compiler.
  • Run time errors can be patched up just like compile time errors by keeping program modification as it is.
  • The compilation process is faster.
  • The memory used is less.
  • Handling batch programs become very flexible using Incremental compiler.
  • In incremental compiler program structure table is maintained for memory allocation of target code. When a new statement is compiled the new entry for it is created in program structure table. Thus memory allocation required for incremental compiler need not be contiguous.
  • Helps in tracking the dependencies on source program.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!