Compiler Assignment
Compiler Assignment
F (E) id
. (E)
GOTO (3o,E) =1
closure ot S . E S’E
S.E
E’T.
E’T *F
f’.(E)
F’.d
T F.
F’(.E)
Cnous getting the elou ot t)
F.(E)
GOTO (11,+) = 3e
EEt.T
FCE)
c.(E)
Go70 (4 td) =Is
T T* f.
F(E)
6E.+T
F’ (t)'
GOTO(IyF
&OTO (Ig,t) =1G
GoTo (T4 ()= I4
(I,td) = Ig
Is GUTO (Ti)Ig
GoTO
(J, id)= IS
G0TO
farsing Tabte
Anpt
states Aetion Tterrh
"Tterns
T
2 2
4
y4
8 2 3
S5
r6
64
SS
8 S6
(1
02) Gtven Seman bt nudeo
-E-val = ? haeto fnd
Eyal - Tvad
Tual = T*val + F.val
be simplifeo to;
T.val t F.val
Using T-T#f Tval
oeratr that euate
find the appnpt iatk
naw We hae to
erpeyjn to 20. int dh
Gval =Ewal Toval.
ypothess:E’E8T
45 | 13lll2
hypute
bavat EAT
22
we
GS -4+ t -s
+6-3t-4
. # has pre c£den ce
) 24
Q3)
calcuiabon of the loop inuarant
Dremeving the
ubside the nlle
lop to eplace
loop
Ttdundant Cal Culatduy
p1
i-1
wntle i<nn theo
t1=i
t2 = ii
i
b2 = t2*
S = S+t1
S= S+ t2
2) = 1
B) tf (i >n)
g0 to 11
i
t2 = i
s) t 2
6) t2*
S =S+ t1
+)
8) S S+t2
goto
1
t
S
t2
t2
tii
116
Operato
Temporony Operand
L
and2 oer
epresentation Quadrvples
condition oeoUt 11)
3 to
i+1 i= 4)
q)