####### DOCUMENTATIATOIAITAT ION ######## Files: Typechecker.hs: Simple modification of the bnfc-generated Testsyntax which calls the type-checking functions. Typecheck.hs: Contains the type-checking functions typeCheckExp, typeCheckVar and typeCheckStm and some utility functions, responsible for the entire type-checking process. Abssyntax.hs, Parsyntax.y, Lexsyntax.x,ErrM.hs,Printsyntax.hs,Skelsyntax.hs: The files generated by bnfc, only modification is the removal of the Bool type in Abssyntx.hs so haskell's internal type can be used. typing rules ++++++++++++ (t is little tau, T is large tau, E is 'in', and + is that other symbol) [Eq, Neq] e:bool <= e1:t & e2:t where e is e1 Eq e2. [Plus, Minus, Times, Div] e:int <= e1:int & e2:int where e is e1 Plus e2. [Lt, ELt, Gt, EGt] e:bool <= e1:int & e2:int where e is e1 Lt e2. [Assignment] T+ i := e:t <= i:t E T & T+ e:t where the assignment is identifier i = expression e. [ExpT] u,e:t <= e:t & u:t where the expression is type u expression e. [ENeg] e:int <= e:int [ENot] e:bool <= e:bool [SExp, SBlock] S:NoType <= e:t [SIf] T+ if e then s1 else s2 <= T+ e:bool & T+ s1 & T+ s2 [SWhile] T+ while e do s <= T+ e:bool & T+ s [SDecl] T+ i:t => T', i:t <= i!ET & e:t & u:t (Type u Ident i = Exp e)