Compiler Design: Hoor Fatima
Compiler Design: Hoor Fatima
by
Hoor Fatima
The syntactic level describes the way that program statements are
constructed from tokens. Always defined in terms of context free
grammar.
Compilers
• A compiler is a program that reads a program written in one
language
–– the source language –– and translates it into an
equivalent
program in another language –– the target language.
single-pass
multi-pass
load-and-go
Debugging
optimizing
The Analysis-Synthesis Model of Compilation
The synthesis part constructs the desired target program from the
intermediate representation.
errors
The Analysis-Synthesis Model of Compilation
During analysis, the operations implied by the source program
are determined and recorded in a hierarchical structure called a
tree.
Linear Analysis:
Hierarchical Analysis:
Semantic Analysis:
Analysis of the Source Program
Linear Analysis:
In which the stream of characters making up the source program is
read from left-to-right and grouped into tokens that are sequences of
characters having a collective meaning.
Hierarchical Analysis:
Expressio Expressio
n n Number
Identifier 60
Rate