1. ACTIVE LEARNING
ASSIGNMENT
FOR THE SUBJECT
“COMPILER DESIGN”
Types Of Compiler
Guided By : -
Nidhi B. Shah
Prepared By :-
Hemant H. Chetwani
(130410107010 LY CE-II)
2. What is Compiler ??
• Compiler is a program which takes one language (source program) as
input and translates it into an equivalent another language (target
program).
Compiler
Input
Source
Program
Output
Target
Program
3. Types of compiler
• Incremental Compiler
• Cross Compiler
• Load & Go Compiler
• Threaded Code Compiler
• Stage Compiler
• Just – in – time (JIT) Compiler
• Parallelizing Compiler
According to it’s Pass structure
• One Pass Compiler
• Multi Pass Compiler
4. INCREMENTAL COMPILER
• Incremental compiler is a compiler which performs the recompilation of
only modified source rather than compiling the whole source program.
5. Features of Incremental Compiler
• It tracks the dependencies between output and the source program.
• It produces the same result as full recompile.
• It performs less task than recompilation.
• The process of incremental compilation is effective for maintenance.
6. CROSS COMPILER
• A compiler which runs on one machine and produces the target code for
another machine. Such compiler is called Cross Compiler.
• Compiler runs on platform X and target code runs on platformY.
7. LOAD & GO COMPILER
• Compilers usually produce either absolute code that is executed
immediately upon conclusion of the compilation or object code that is
transformed by a linking loader into absolute code.
• But, this complier generates machine code and immediately executes it.
• Means compilation, assembly, or link steps are not separated from
program execution.
8. THREADED CODE COMPILER
• The threaded code has a form that essentially consists entirely of calls
to subroutines. And the compiler replaces given strings in the source with
given binary code while compiling.
Basically used in database lookup program.
9. STAGE COMPILER
• Stage compiler compiles Prolog
implementations of theoretical machine
to its assembly language.
• Prolog is a general-purpose logic
programming language associated with
artificial intelligence and computational
linguistics.
• Prolog is declarative : the program logic
is expressed in terms of relations,
represented as facts and rules.
10. JUST – IN –TIME (JIT) COMPILER
• In this type of compiler applications are delivered in byte code, which is compiled to
native machine code just prior to execution.
• The JIT compiler is enabled by default, and is activated when a Java method is called.
The JIT compiler compiles the bytecodes of that method into native machine
code, compiling it "just in time" to run. When a method has been compiled, the JVM
calls the compiled code of that method directly instead of interpreting it.
11. PARALLELIZING COMPILER
• Parallelizing compiler converts a serial input program into a form suitable
for efficient execution on a parallel computer architecture.
• The goal of automatic parallelization is to relieve programmers from the
hectic and error-prone manual parallelization process.
12. Types of Compiler (According to it’s Pass Structure)
2.
Multi pass
Compiler
1.
One Pass
Compiler
13. One Pass Compilers Two Pass Compilers
One pass compiler scans the source program only
once.
Two pass compiler does two scans over the source
file. The second pass can be over a file generated
first file.
In this, one pass compiler has to perform some
tasks such as collecting the labels, resolving
forward references and doing the actual
compilation.
In the first pass all it does is looks for label
definitions and insert them in the symbol table. In
the second pass, after the symbol table is
it does the actual compilation.
It is faster than Multi Pass Compilers. It is slower than One Pass Compilers.
It has limited scope for compilation. It has wider scope for compilation due to two
passes.
For example : Pascal Java Requires Multi – Pass compilation.