-
Consider the syntax directed definition shown below :
Here, gen 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 t1 ‘ 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
-
- X = Y + Z
- t1 = Y + Z; X = t1
- t1 = Y; t2 = t1 + Z; X = t2
- t1 = Y; t2 = Z; t3 = t1 + t2 ; X = t3
- X = Y + Z
Correct Option: B
The production E → E + E is used only one time and hence only one temporary variable is generated.