The following grammar generates expressions formed by applying an arithmetic operator + to integer and real constants. When Iwo integers are added, the resulting type is integer, otherwise. it is real.
a) Give a syntax-directed definition to determine the type of each sub expression.
b) Extend the syntax-directed definition of (a) to translate expressions into postfix notation as well as determining types. Use the unary operator inttoreal 10 convert an integer value into an equivalent real value, so that both operands of + in the postfix form have the same type.