Boolean expressions have two primary purposes. They are used for computing the logical values. They are also used as conditional expression using if-then-else or while-do.
Consider the grammar
The relop is denoted by <, >, <, >.
The AND and OR are left associated. NOT has the higher precedence then AND and lastly OR.
The EMIT function is used to generate the three address code and the newtemp( ) function is used to generate the temporary variables.
The E → id relop id2 contains the next_state and it gives the index of next three address statements in the output sequence.
Here is the example which generates the three address code using the above translation scheme: