Module 09: Dynamic types

This module is due at 1:15pm on Tuesday, October 11, though I strongly suggest that you try to have it finished, or at least almost finished, before class on Thursday October 6.

In this module, we will start exploring type systems, a central topic in programming language design.

We will continue building on the Arith language from previous weeks.

Extending the syntax

Extending the interpreter

Of course, the interesting thing we have done is to introduce the possibility of a third kind of error, namely, type errors. We now have both integers and booleans in our language, and it would be an error, say, to try to add two boolean values; addition only applies to integers.

With type errors we have an interesting choice: should type errors be caught at runtime, or should they be caught in a separate type checking phase before the program is run?

Today, you will implement dynamic type checking for our language; in future modules you will implement a static type system.

Feedback