Add the productions Exp → floatconst TypeId → float id to Grammar 4.1. This introduces floating-point numbers to the language. The operator + is overloaded so it can do integer addition or...


Add the productions


Exp → floatconst


TypeId → float id


to Grammar 4.1. This introduces floating-point numbers to the language. The operator + is overloaded so it can do integer addition or floating-point addition, and =


is extended so it can also compare floating point numbers for equality.


(a) Extend the interpretation functions in Figs. 4.2–4.4 to handle these extensions.


(b) We now add implicit conversion of integers to floats to the language, using the


rules: Whenever an operator has one integer argument and one floating-point


argument, the integer is converted to a float. Extend the interpretation functions


from question a) above to handle this.



May 26, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here