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-> E+T | T T-> T*F | F F-> 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. Assume 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 temporary variables for intermediate results). 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!