]> Joshua Wise's Git repositories - snipe.git/blobdiff - type/typechecker.sml
Add strings to type system and parser/lexer
[snipe.git] / type / typechecker.sml
index 06c6d89dce342aafdb9abc4ce88c3196b2573b6b..8be373158bbeac5c1bea4c2e34d473f919ac6436 100644 (file)
@@ -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
This page took 0.023736 seconds and 4 git commands to generate.