A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

Discussion Forum

Que. Consider the syntax directed definition shown below.

S → id : = E {gen (id.place = E.place;);}
E → E1 + E2 {t = newtemp ( ); gen (t = El.place + E2.place;); E.place = t}
E → id {E.place = id.place;}

Here, gen is a function that generates the output code, and newtemp is a function that returns the name of a new temporary variable on every call. Assume that ti's are the temporary variable names generated by newtemp. For the statement 'X: = Y + Z', the 3-address code sequence generated by this definition is
a. X = Y + Z
b. t1 = Y + Z; X = t1
c. t1 =Y; t2 = t1 + Z; X = t2
d. t1 = Y; t2 = Z; t3 = t1 + t2; X = t3
Answer:t1 = Y + Z; X = t1
Confused About the Answer? Ask for Details Here
Know Explanation? Add it Here

Similar Questions: