aboutsummaryrefslogtreecommitdiff
path: root/TypeCheck.hs
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-08-26 23:16:00 +0200
committertomsmeding <tom.smeding@gmail.com>2017-08-26 23:16:15 +0200
commitaa049227c17f15ad22092f1fcab4410bbf3521ba (patch)
tree7046e62ff530746754e19d07d4e8bc7d7a42ea22 /TypeCheck.hs
parentb2c5ef755bc7a2c736c5f52c4753dde66c04c3aa (diff)
Cleanup and features
debugger, bitwise ops, bounds checking, hex literals, better typing of some optimisations, makefile fix, exit function.
Diffstat (limited to 'TypeCheck.hs')
-rw-r--r--TypeCheck.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/TypeCheck.hs b/TypeCheck.hs
index 13d33c9..66affa4 100644
--- a/TypeCheck.hs
+++ b/TypeCheck.hs
@@ -33,6 +33,7 @@ emptyDB = [Map.fromList
[("putc", DBFunc Nothing [TChar]),
("putint", DBFunc Nothing [TInt]),
("getc", DBFunc (Just TInt) []),
+ ("exit", DBFunc Nothing [TInt]),
("_builtin_malloc", DBFunc (Just $ TArr TChar Nothing) [TInt])]]
withScope :: TypeDB -> (TypeDB -> a) -> a
@@ -152,6 +153,7 @@ annotateStatement (State {stDfunc = DFunc mrt _ _ _}) db (SReturn (Just expr)) =
" in 'return'"
return (db, SReturn (Just expr'))
annotateStatement _ db (SExpr expr) = (\expr' -> (db, SExpr expr')) <$> annotateExpr db expr
+annotateStatement _ db SDebugger = return (db, SDebugger)
annotateExpr :: TypeDB -> Expression -> Error Expression
annotateExpr db (EBin bo e1 e2 _) = do