Thursday, October 3, 2013

Compiler Basic



A 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 multi pass. 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 backtracking Based on backtracking
Called narrow compiler Called wide compiler
Faster Comparatively slower
Limited scope, code generation not efficient Wider scope and better code generation
Definition have to declared before logic Definition can be anywhere in code
Support Pascal .Doesn’t support most of the modern programming language like java, c++ etc. All most all modern programming language java, c++ etc.

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

 

No comments:

Post a Comment