• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

GATE | GATE-CS-2003 | Question 59

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

Please comment below if you find anything wrong in the above post
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!

Last Updated :
Share your thoughts in the comments