Sir Chhotu Ram Ins. of Engg and Technology: Srs Report On Compiler
Sir Chhotu Ram Ins. of Engg and Technology: Srs Report On Compiler
OF ENGG
AND TECHNOLOGY
SRS REPORT ON
COMPILER
SUBMITTED TO SUBMITTED BY
Er. LAXMI SHANKAR AAKASH GOSWAMI
100150501
B. TECH (I.T)
3rd year
(A)Introduction
A compiler is computer software that transforms
computer code written in one programming language (the
source language) into another programming language (the
target language). Compilers are a type of translator that
support digital devices, primarily computers. The
name compiler is primarily used for programs that
translate source code from a high-level programming
language to a lower level language to create
an executable program.
1.Purpose
Compiler technology evolved from the need for a strictly
defined transformation of the high-level source program
into a low-level target program for the digital computer.
The compiler could be viewed as a front end to deal with
analysis of the source code and a back end to synthesize
the analysis into the target code. Optimization between the
front end and back end could produce more efficient target
code.
Some early development of compiler technology
(B)Functional Requirement
A typical compiler does the following steps
Parsing: the source text is converted to an abstract
syntax tree (AST).
Resolution of references to other modules (C
postpones this step till linking).
Semantic validation: weeding out syntactically
correct statements that make no sense, e.g.
unreachable code or duplicate declarations.
Equivalent transformations and high-level
optimization: the AST is transformed to represent a
more efficient computation with the same semantics.
This includes e.g. early calculation of common
subexpressions and constant expressions,
eliminating excessive local assignments, etc.
Code generation: the AST is transformed into
linear low-level code, with jumps, register allocation
and the like. Some function calls can be inlined at
this stage, some loops unrolled, etc.
Peephole optimization: the low-level code is
scanned for simple local inefficiencies which are
eliminated.
(c)Behavioural Description
(D)validation Criteria
parse the program
check for syntax errors
check for data types
create internal structure in memory
verify the program semantic
optimize the structure
translate the program in other language
generate files on disk
link the files into an executable
(E)Advantage and Disavantage of
Compiler
Advantage
1. The entire program is verified so there are no syntax
or semantic errors;
2. The ececutable file is optimized by the compiler so it
execute faster;
3. User do not have to execute the program on the
same machine it was built.
4. One major advantage of programs that are compiled
is that they are self-contained units that are ready to
be executed. Because they are already compiled
into machine language binaries, there is no second
application or package that the user has to keep up-
to-date.
5. Compilers read commands from a machine
language written in binary, i.e., long strings of zeros
and ones. While computers can read this language
efficiently.
6. hardware optomization
Disadvantages
1.hardware specific
2.high compile time
3. editing and deploying the code is a lot slower than
interpreter