This question is about a semantic variation of the heap abstraction. A typed heap enforces the property

Question:

This question is about a semantic variation of the heap abstraction.
A typed heap enforces the property that in a memory location, only values of compatible types can be stored. Two types are compatible if one is the subtype of the other. Extend the Reflang interpreter to support a typed heap.
Modify the semantics of the assign expression assignexp to check that upon setting the value of a location, the type of the new value is compatible with the type of the old value already stored in that location. Otherwise, raise a dynamic error.
in Java, you can use isAssignableFrom to check for compatibility of types.
The following log interaction illustrates the semantics of a typed heap:image

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: