Beruflich Dokumente
Kultur Dokumente
ROLL_NO: B18CS143
SECTION: CSE-III
ABSTRACT
We are in need of a interface or a software program that changes given source code
to our required code, that interface or software program is simply called as compiler.
Compiler simply cannot convert our code, compiler consists of many layers or stages,
In which each layer performs particular task. Let’s see all these.
Introduction
Computer cannot understand our language (high level language),it can understands
only binary code(low level language).Compiler is the software that converts into
binary code. Before going into compiler, lets see what are pre-processors,
translators, linkers and loaders as well as Language Processing System
LANGUAGE PROCESSING SYSTEM: It consists of 1) Pre-processor, 2) Compiler, 3)
Assembler, 4) Linker, 5) Loader. All these shows how the language is processing.
PRE-PROCESSOR: It is a program which works on input data to give output. The
output is a high-level language. Its main task is to load files that all are useful for
compiler.
COMPILER: It compiles the code and generate intermediate code to give target code.
Displays error messages if any errors are present in our source code.
ASSEMBLER: It is also like a compiler used for assembly language which translates
into machine understandable code. It is useful for developers to access hardware.
LINKERS: Its main task is to link files such as source file, library file, object file into
single file in order make this single file into executable file.
LODAERS: We can see loader in operating system whose task is to load executable
files into memory and execute them. It also checks for memory space to load data.
3. Semantic Analyzer:
Semantic analyser is to check the syntax such that they are meaningful. Its
input is syntax tree and checks whether the tree is semantically meaningful or
not. And by performing some tasks like type checking, level checking, Flow
control checking in order to generate output as syntax tree which is
semantically meaningful.
5. Code Optimization:
Code optimiser belongs to synthesis phase which optimizes intermediate code
in order to decrease compilation time by using limited resources of system
such as CPU, memory etc. Optimization is done by removing unnecessary
symbols which makes code size smaller. Divided into 2 types 1) Machine
Independent and 2) Machine Dependent
6. Code Generation:
Input is taken from code optimizer performs particular task based on special
instructions and generates machine understandable code.
CONCLUSION
This is how the compiler translates source code into target code. It consists of two
phases known as analysis phase and synthesis phase also known as front end and
back end of compiler respectively.