Project #8: Typed μScheme Polymorphic Type Checker

Submit: Turn in your tuscheme directory using the turnin command on morbius.mscsnet.mu.edu or one of the other Systems Lab machines.

Work is to be completed in teams of two. Be certain to include both teammates names in the file. You may submit multiple times, but only the last turnin will be kept. The automatic submission system will not accept work after the deadline.

Include a comment block at the very top of tuscheme.sml that contains the following:

  (* COSC 3410 - Project 9 *)
  (* @author [your names] *)
  (* Instructor [your instructor] *)
  (* TA-BOT:MAILTO [your email addresses] *)

The Type Checker

Textbook Chapter 6, section 6.9.7: Exercise #19 - Continue implementing the type checker for Typed μScheme, focusing on the polymorphic types using the '@' operator, type-lambas and forall types, such as in list operations.

Examples:
> (val id (type-lambda ['a] (lambda ([x : 'a]) x)))
id : (forall ['a] ('a -> 'a))
> (@ id int)
>function< : (int -> int)
> (@ id bool)
>function< : (bool -> bool)
> (@ id sym)
>function< : (sym -> sym)
> ((@ id int) #t)
type error: In call to (@ id int), parameter 1 has type bool where type int is expected
> ((@ cons int) 5 (@ '() int))
(5) : (list int)
> ((@ cons int) 'foo (@ '() int))
type error: In call to (@ cons int), parameter 1 has type sym where type int is expected

[back]

[Revised 2025 Dec 15 12:50 DWB]