The purpose of this assignment is to help you learn about type systems.
As in the ML homework, use function definition by pattern matching. In particular, do not use the functions [[null]], [[hd]], and [[tl]].
Hint: Exercise 1 is more difficult than it first appears. I encourage you to scrutinize the lecture notes for similar cases, and to remember that you have to be able to type check every expression at compile time.
2. [16pts] Do Exercise 2 on page 244 of Ramsey and Kamin:
finish the type checker for Typed Impcore by implementing the rules
for arrays. Turn in this exercise in file
timpcore.sml.
My solution to this problem is 21 lines of ML.
11. [14pts] Do Exercise 11 on page 245 of Ramsey and Kamin: write exists? and all? in Typed uScheme. Turn in this exercise in file 11.scm.
13. [40pts] Do Exercise 13 on page 245 of Ramsey and Kamin:
write a type checker for Typed uScheme.
Turn in this exercise in file tuscheme.sml, which should also
include your solution to Exercise 16 below.
Don't worry about the quality of your error messages, but do
remember that your code must compile without errors or warnings.
My solution to this problem is about 120 lines of ML.
It is very similar to the type checker for Typed
Impcore that appears in the book.
It could have been a little shorter if I had given worse error messages.
16. [20pts] Do Exercise 16 on page 246 of Ramsey and Kamin:
add sum types to Typed uScheme.
As a hint, remember that you can call [[eval]] from a primitive function.
Turn in the code for this exercise in file tuscheme.sml, which should also
include your solution to Exercise 13 above.
Please include the answers to parts (a)-(c) in your README file.
My solution to this problem is about 15 lines of ML.
If you want to submit up to 3 test cases to be applied to other people's type checkers, submit them in a file called [[tests]], complete with comments that tell us how to run them.
Submit using submit-typesys.