-- $Id: Problem_2_2_a.hs,v 1.3 1998/01/28 18:27:39 leavens Exp $

-- Gary T. Leavens
-- Testing for Chapter 1, problem 2.2, a

module Problem_2_2_a where
import CoreTypeHelpers
import Problem_2_2_a_Typing
import Problem_2_2_a_Parser

type_check :: String -> ATree Command
type_check = annotate . read

pretty_type = show . type_check

-- the following could be more extensive, but should give you the idea

test 1 = pretty_type "int loc 3 := 2"
test 2 = pretty_type "bool loc 2 := (1 = 2)"
test 3 = pretty_type
   ("while @bool loc 1 " ++
    "do bool loc 2 := (2 = 3); " ++
    "    bool loc 1 := not (1 = 1)" ++
    "od")
