Escolar Documentos
Profissional Documentos
Cultura Documentos
!!
"#
By
Muneendra Ojha
Ä $%
Basic knowledge of programming languages.
Basic knowledge of FSA and CFG.
Knowledge of a high programming language for the programming
assignments.
&# '(
Alfred V. Aho, Ravi Sethi, and Jeffrey D. Ullman,
³|
Addison-Wesley, 1986.
Midterm : 30
Homework : 15
Quizzes(Random) : 15
Attendance : 10
nternal :5
Final : 75
error messages
error message
( Finally Loader loads the executable into memory for execution.
Lexical token stream Syntax syntax tree Semantic
| Analyzer Analyzer Analyzer
syntax tree
intermediate intermediate
Machine
Code representation representation ntermediate
ndependent
Generator Code Generator
Code Optimizer
target-machine
code
Machine
Dependent
Code Optimizer
Symbol Table
6:35 PM ndian nstitute of nformation Technology - Allahabad 10
Ä !"|
Each phase transforms the source program from one representation
into another representation.
They communicate with error handlers.
They communicate with the symbol table.
oldval 12
The type of the identifier must match with type of the expression
Ex:
if A>B goto L2
Goto L3
L2:
Similarly the examples of Grammar simplification in case of CFG follows the same idea.
Shifting Loop nvariant code out of the loop creates scope for Loop optimization
Ex:
( assume that we have an architecture with instructions whose at least one of its operands is
a machine register)
MOVE id2,R1
MULT id3,R1
ADD #1,R1
MOVE R1,id1