01 Compiler _ Introduction
01 Compiler _ Introduction
Example
Position:= initial + rate *60
A+/B id+/id
Semantic Analysis
a=a×2×b×c×d
b and d character string
Intermediate Code Generations
An intermediate representation of the final machine language
code is produced. This phase bridges the analysis and synthesis
phases of translation.
id1 = id2 + id3 * id4
Example
temp1:= int to real (60)
temp2:= id3 * temp1
temp3:= id2 + temp2
id1:= temp3.
Code Optimization
This is optional phase described to improve the intermediate
code so that the output runs faster and takes less space.
Example
Example
MOVF id3, r2
temp1:= id3 * 60.0 MULF *60.0, r2
Id1:= id2 +temp1 MOVF id2, r1
ADDF r2, r1
MOVF r1, id1
Compiler Example