Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 7

Role of Data

Structures in Compiler Design


CAP 523

Presented to Presented by
Mrs.Jiteshwar Anand Prabjot
3010060036
Roll no 25
INTRODUCTION

 
A compiler is a computer program (or set of
programs) that transforms source code written in
a programming language (the source language)
into another computer language (the target
language, often having a binary form known as
object code). The most common reason for
wanting to transform source code is to create an
executable program.
STRUCTURE OF THE COMPILER
DESIGN:-
STRUCTURE OF THE COMPILER
DESIGN(CONT)…
• Lexical Analysis:-
• LA or Scanners reads the source program one character at a
time, carving the source program into a sequence of automic units
called tokens.
• Syntax Analysis:-
• The second stage of translation is called Syntax analysis or
parsing. In this phase expressions, statements, declarations etc…
are identified by using the results of lexical analysis. Syntax analysis
is aided by using techniques based on formal grammar of the
programming language.
• Intermediate Code Generations:-
• An intermediate representation of the final machine language
code is produced. This phase bridges the analysis and synthesis
phases of translation.
STRUCTURE OF THE COMPILER
DESIGN(CONT)…
Code Optimization:-
This is optional phase described to improve the
intermediate code so that the output runs faster and
takes less space.
Code Generation:-
The last phase of translation is code generation. A
number of optimizations to reduce the length of
machine language program are carried out during this
phase. The output of the code generator is the machine
language program of the specified computer.
The other factors in compiler design
where data structure used are:-
1. Type check and cast expressions
2. JVM byte-code generation
3. Compiling the sytlesheet
4. Compiling top-level elements
5. Compiling template code
6. Compiling instructions, functions ,expressions
and patterns.
THANKS……….

You might also like