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.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here