CSE-307 Programming Assignment #4

Type Checking Solution

May 7, 2002

 
 
 


Description:

In this project assignment you have to practice programming in ML and constructing type checking proof trees.

2. Type checking.

2.1 Sum Types: Discussed today in the class.

2.2 Monomorphic Type Checking: Discussed today in the class.

2.2 Polymorphic Type Checking

  1. Define FST and SND as two polymorphic lambda expressions (functions). Discussed today in the class.
  2. Assuming that a: int, b:bool apply FST to a and b and type check the resulting expression.
  3. Solution:  Check the link for the abstract syntax tree and the type-checking tree. Many thanks go to David Sapir who provided the scanned gifs. Note that the type checking tree was written upside-down, to match the abstract syntax tree. You may construct the type-checking tree the way you are more comfortable with, i.e., either upside-down or normally.

Radu Grosu, 5/7/02