Sunday, May 18, 2014

What is Compiler. Types of Compiler



compiler is a computer program that transforms source code written in a programming language into another language. Compiler is primarily used for programs that translate source code from a high-level programming language to a lower level language (e.g., assembly language or machine code).

Compiler
·         Detect errors
·         Generate correct and efficient code
·         Run time organization
·         Format according assembler or linker convention

Ø  Basis on number of processing compiler is two types, single pass and multipass. Single pass compiler passes through the parts of each compilation unit only once, immediately translating each part into its final machine code. In contrast multi-pass compiler converts the program into one or more intermediate representations steps in between source code and machine code, and which reprocesses the entire compilation unit in each sequential pass.


Single-Pass Compiler
Multi-pass Compiler


Compiler that passes through the source code of each compilation unit only once.Compiler that processes the source code of a program several times.
Doesn’t support backtrackingBased on backtracking
Called narrow compilerCalled wide compiler
FasterComparatively slower
Limited scope, code generation not efficientWider scope and better code generation
Definition have to declared before logicDefinition can be anywhere in code
Support pascal .Doesn't support most of the modern programming language like java, c++ etcAll most all modern programming language java, c++ etc

Ø  Depending on machine dependency: cross platform compiler and native compiler

No comments:

Post a Comment