## Types of 3 address code:

Computing 3 address code for simple statements:-

**-(a+b)*(c+d)+(a+b+c+d)**

Solution:-

Explanation: To make a 3 address code for a statement rules of precedence and associative rules are applied.Basic BODMAS rule could be used to check the precedence of the grammar.

Here in this question as Brackets were having more precedence it will be solved first. secondly multiplication as it has more precedence and then addition.

Example 2:

In this example **^ **is having more precedence than other operators ,so it will get solve first ,Secondly **^** symbol is right associative therefore **c^f** will be converted first then **b^c.** *** **& **/** is having equal precedence and both are left associative ,therefore ***** will be converted first.

Here also **^ **is having more precedence than other operators ,so it will get solve first ,Secondly **^** symbol is right associative therefore **c^f** will be converted first then **b^c.** *** **& **/** is having equal precedence and both are left associative ,therefore ***** will be converted first.

Example 3:

Example 4

In this example only rule of associativity is followed .since + is left associative . 3 address code will be generated from left.

Example 5: