GATEverse
← GATE CSE 2003

Q59

MCQ2 marks, −0.5

Consider the syntax directed definition shown below.

S→id:=E{gen(id.place=E.place;);}E→E1+E2{t=newtemp();gen(t=E1.place+E2.place;);E.place=t;}E→id{E.place=id.place;}\begin{array}{ll} S \rightarrow \mathbf{ id :=} E&\qquad \{gen(\mathbf{ id}.place = E.place;);\}\\ E \rightarrow E_1 + E_2 &\qquad \{t = newtemp();\\ &\qquad gen(t = E_1.place + E_2.place;);\\ &\qquad E.place = t;\}\\ E \rightarrow id&\qquad \{E.place = \mathbf{id}.place;\} \end{array}

Here, gengen is a function that generates the output code, and newtempnewtemp is a function that returns the name of a new temporary variable on every call. Assume that ti′t_i's are the temporary variable names generated by newtempnewtemp. For the statement ‘X:=Y+Z’,\text{‘}X : = Y + Z\text{'}, the 33-address code sequence generated by this definition is

Sign in to save attempts.

Loading…