X-Git-Url: http://git.joshuawise.com/snipe.git/blobdiff_plain/5c79bb689ab446551bc7ec4497e6c9b75582837e..5c90fbb8681e975ccd0a1bc407b31daa1daef38a:/type/typechecker.sml?ds=inline diff --git a/type/typechecker.sml b/type/typechecker.sml index 06c6d89..8be3731 100644 --- a/type/typechecker.sml +++ b/type/typechecker.sml @@ -25,6 +25,7 @@ struct of NONE => (ErrorMsg.error mark ("variable `"^(Symbol.name a)^"' not declared here") ; raise ErrorMsg.Error) | SOME t => t) | A.ConstExp _ => T.Int + | A.StringExp _ => T.String | A.OpExp (A.EQ, [a, b]) => (case (typeof (tds, funcs) vars mark a, typeof (tds, funcs) vars mark b) of (T.Int, T.Int) => T.Int (* You shall pass! *) @@ -207,6 +208,7 @@ struct raise ErrorMsg.Error ) | SOME ASSIGNED => ()) | varcheck_exp env (A.ConstExp _) mark = () + | varcheck_exp env (A.StringExp _) mark = () | varcheck_exp env (A.OpExp (_, l)) mark = List.app (fn znt => varcheck_exp env znt mark) l | varcheck_exp env (A.FuncCall (f, l)) mark = List.app (fn znt => varcheck_exp env znt mark) l | varcheck_exp env (A.Marked m) mark = varcheck_exp env (Mark.kane m) (Mark.ext m) @@ -408,6 +410,7 @@ struct (* XXX does not check big vs. small types *) fun typecheck_type (tds, funcs) mark T.Int = () + | typecheck_type (tds, funcs) mark T.String = () | typecheck_type (tds, funcs) mark T.TNull = () | typecheck_type (tds, funcs) mark (T.Pointer t) = typecheck_type (tds, funcs) mark t | typecheck_type (tds, funcs) mark (T.Array t) = typecheck_type (tds, funcs) mark t