assignment in programming language

wejdan
A1.doc

Q1/ Using the given Grammar, evaluate the attribute values and draw a “fully attributed Parse tree” for each of the following statements: (10 marks)

image2.png

a. A = B + ( A * C ) [ Look up : A (real), B (int), c (real) ]

b. C = A * ( C + B ) [ Look up : A (real), B (real), c (int) ]

Q2/ Explain the four criteria for proving the correctness of a logical pretest loop construct of each of the following forms: (8 marks)

a. while m <> n do m = m + 2 end { m = n }

b. while k > 2 do k = k / 2 end { k = 2 }

image1