Introduction Structure
Introduction Structure
COMPILER DESIGN
Course code:
SCS1303
1/3/23 SCS1303 Compiler Design 1
Course Objective:
• To explore the principles, algorithms, and data structures
involved in the design and construction of compilers.
• To introduce the theory and tools that can be employed in
order to perform syntax-directed translation of a high-level
programming language into an executable code.
Prerequisite Courses:
• Theory of Computation
• Data Structures
• Programming Languages
Syllabus:Compiler_Design.doc
1/3/23 SCS1303 Compiler Design 2
1/3/23 SCS1303 Compiler Design 3
UNIT 1 LEXICAL ANALYSIS
• Structure of compiler
• Functions and Roles of lexical phase
• Input buffering
• Representation of tokens using regular expression
• Properties of regular expression
• Finite Automata
• Regular Expression to Finite Automata
• NFA to Minimized DFA.
• Language Processors
• Structure of Compiler
1/3/23 SCS1303 Compiler Design 5
Software
• Software is a set of computer programs which are
designed and developed to perform specific task desired
by the user or the computer itself.
Software
System Application
Software Software
Once a program is compiled, its source code is not useful for running the
code.
For interpreted programs, the source code is needed to run the program
every time.
1/3/23 SCS1303 Compiler Design 14
Compiler vs Interpreter
COMPILER INTERPRETER
Compiler takes large amount of time to Interpreter takes less amount of time to
analyze the entire source code but the
analyze the source code but the overall
overall execution time of the program is
execution time of the program is slower.
comparatively faster.
Preprocessor:
– It replaces macros with their definitions, discovers
dependencies and resolves preprocessor directives.
Linker:
– Link and merge various object files to create an executable
file.
– Search for called modules in a program and to find out the
memory location where all modules are stored.
Loader:
– Performs the tasks of loading executable files into memory
and run them.
– Calculates the size of a program which creates additional
memory space.
.
1/3/23 SCS1303 Compiler Design 22
The analysis of a source program is divided into
mainly three phases. They are:
Linear Analysis
Hierarchical Analysis
Semantic Analysis
alternate operator
concatenation operator
where ,
letter –alphabet set {a-z A-Z}
digit –number set {0-9}
1/3/23 SCS1303 Compiler Design 26
APPLICATIONS
• Grammar Checking
• Indexing for information retrieval
• Information extraction
• Machine translation
• Speech synthesis from parses
• Speech recognition using parsing