Sei sulla pagina 1di 8

SIR CHHOTU RAM INS.

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

 1952 – An Autocode compiler developed by Alick


Glennie for the Manchester Mark I computer at the
University of Manchester is considered by some to be
the first compiled programming language.
 1952 – Grace Hopper's team at Remington Rand wrote
the compiler for the A-0 programming language (and
coined the term compiler to describe it)[12][13], although
the A-0 compiler functioned more as a loader or linker
than the modern notion of a full compiler.
 1954-1957 – A team led by John
Backus at IBM developed FORTRAN which is usually
considered the first high-level language. In 1957, they
completed a FORTRAN compiler that is generally
credited as having introduced the first unambiguously
complete compiler.
 1959 – The Conference on Data Systems Language
(CODASYL) initiated development of COBOL. The
COBOL design drew on A-0 and FLOW-MATIC. By the
early 1960s COBOL was compiled on multiple
architectures.
 1958-1962 – John
McCarthy at MIT designed LISP.[14] The symbol
processing capabilities provided useful features for
artificial intelligence research. In 1962, LISP 1.5 release
noted some tools: an interpreter written by Stephen
Russell and Daniel J. Edwards, a compiler and
assembler written by Tim Hart and Mike Levin.
2.Definition
A compiler is a program that translates a source program
written in some high-level programming language (such as
Java) into machine code. The generated machine code
can be later executed many times against different data
each time.
3.Scope
1.Writing a compiler gives a developer experience with
large-scale applications development.
2. Automatic code optimization.
3. Optimization of the compiler itself.
4. Various strategies for finding bugs (and suspicious
places) in code.
5. Compiler writing is a basic element of programming
language research. Many language researchers write
compilers for the languages they design.

(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

A compiler is likely to perform many or all of the following


operations: preprocessing, lexical analysis, parsing, semantic
analysis (syntax-directed translation), conversion of input
programs to an intermediate representation, code
optimization and code generation. Compilers implement these
operations in phases that promote efficient design and correct
transformations of source input to target output.
Compilers are not the only translators used to transform
source programs. An interpreter is computer software that
transforms and then executes the indicated operations.
The translation process influences the design of computer
languages which leads to a preference of compilation or
interpretation. In practice, an interpreter can be
implemented for compiled languages and compilers can
be implemented for interpreted languge.

(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

Potrebbero piacerti anche