Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
System Programming
CSE 368
Expectations:
So, here are all the identifiers and all the corresponding tokens used for
them.
S. NO. TOKEN
I.A id#1
II.B id#2
III.C id#3
IV.D id#4
V .E id#5
VI.F id#6
VII. G id#7
VIII .W id#8
IX .X id#9
X. Y id#10
XII . Z id#11
XIII .U id#12
XIV .V id#13
XV . I id#14
XVI .J id#15
XVII.K id#16
XVII.L id#17
SR NO TOKEN
I .if key#1
II .while key#2
SR NO TOKEN
I .< op#1
IV. OR op#4
V. + op#5
VI. - op#6
VII. * op#7
VIII.== op#8
d.) Special symbol- These are special notations like array parameter etc…
the class code is (ss).
SR NO TOKEN
I.( ss#1
II.) ss#2
III .[ ss#3
IV.] ss#4
V., ss#5
Expectation2:- Perform the syntax tree for last two operations (else
statements) used in program.
Solution: A)
B)
Expectation3:- Perform the semantic analysis over the syntax.
(1) L.place = i
(2) E.place = i
(3) Elist.array = X
Elist.place= i
Elist.dim=1
(4) L.place = j
(5) E.place= j
(6) M=2 , t1 (newtemp) t1=i*d2
Elist.place = t1 t1=t1+j
Elist.dim =m
Elist.array = X
(8) L.place = i
(9) E.place = i
(10) L.place=j
(11) E.place = j
(13) Elist.array = Y
Elist.place = t4
Elist.dim =1
(14) L.place = k
(15) E.place = k
(16) m=2 , t5 (newtemp) t5=t4*d4
Elist.array = Y
Elist.place = t5 t5=t5 + k
Elist.dim=2
(19) L.place = z
L.offset= NULL
(20) L.place= z
(21) t9 (newtemp) t9 = t8 + z
(22) t2[t3] := t9
3. Apecification of the all the specification modes that has been used
for the variable accessing.
Code generation is as follows:-
4) Assignment operator (=) , with (id # 1) to (id # 20) which -( id # 10)
7) Next step is of addition (id # 1) with (id # 11) which will give (id # 11)
8) Again there is unary operation (negation) from (id # 12) after (id # 18)
10) After this we multiply (id # 12) with (id # 13) giving (id # 13)
12) After doing all operations , we substrate (id # 12) from (id # 13)
A Real 2001
C Real 2002
B Real 2004
D Real 2005
F Real 2008
b1 Real 2014