CS 6848 - Principles of Programming Languages

Homework 4: Scheme Type Inference

Consider a type system where types are generated from the grammar:

t ::= t -> t | int | boolean | a

where a ranges over a set of type variables. Use JTB/GJ and JavaCC and write in Java one or more visitors which from a MiniScheme program produces the principal type, or decides that no type exists. Specifications about the subset of MiniScheme can be found here.

Your main file should be called P4.java, and if P.scm contains a MiniScheme program, then

java P4 < P.scm

should print either the principal type, or

Program does not type check

Note, your program must take input from standard input and write to standard output (so that we can use the redirection).

A sample Main.java can be found here.

Grading policy
Your homework will be graded for a total of 100 marks. Of these 50 marks will be for the public testcases and 50 marks for the TAs testcases.