Question: The following grammar applies + and * operators to integer and real constants. The result of adding two integers is type integer, otherwise the result

The following grammar applies + and * operators to integer and real constants. The result of adding two integers is type integer, otherwise the result is type real. A number (T) with a decimal point is real, otherwise is integer. E rightarrow E + T | T T rightarrow T*F | F F rightarrow num.num | num Write a syntax directed definition for this grammar. To determine the type of each subexpression: if an operation involves mixed integer and real values convert integer values to real. Write semantic actions to output 3-addres code as intermediate language. Assume you have the following operators: INT2RL dest src//integer to real ADDI dest src1 src2//integer sum ADDR dest src1 src2//real sum MULI dest src1 src2//integer multiply MULR dest src1 src2//real multiply (If you believe you need any additional 3-address operators, you may add them to the above list). Use register values R0 to R32 as needed for intermediate results - in this problem do not be concerned with allocating or deallocating registers
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
