COMPILER DESIGN

TOOLS AND TECHNIQUES FOR COMPILER DESIGN

MISCELLENOUS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
In the following statement:a=b*c+d*e. Compiler generates 3-address code for the above expression. The total number of temporary variables requried are
A
4
B
5
C
6
D
Can’t generate three address code
Explanation: 

Detailed explanation-1: -What are the types of three address code? The types of three address code are Assignment Statement(x = y op z and x = op y), While Statement, Switch Statement, Copy Statement, Unconditional Jump, Conditional Jump, Procedural call, Array Statement, and For Statement.

Detailed explanation-2: -Expert-Verified Answer A minimum number of temporary variable needed to swap the contents of 2 variable is 0. The swapping can easily be done without any other temporary variable with the above method or series.

Detailed explanation-3: -A variable is considered live if it is used in the block and not overwritten by any other variable. Rule of liveliness: If a block does not use a variable which is live after its exit point, then this variable is live also before the entry point of that block.

There is 1 question to complete.