defaultAddressBook :: Addressbook
defaultAddressBook = extend "1printint" (LAB "1printint" 1)
$ extend "1printchar" (LAB "1printchar" 1)
- $ extend "1readchar" (LAB "1readchar" 0)
+ $ extend "read" (LAB "read" 0)
$ extend "1readint" (LAB "1readint" 0)
$ extend "isEmpty" (LAB "isempty" 1)
'Map'.newMap
,Instr "str" [Raw "RR"] ""
,Instr "unlink" [] ""
,Instr "ret" [] ""
- ,Lab "1readchar"
+ ,Lab "read"
,Instr "link" [Lit 0] ""
,Instr "trap" [Lit 11] "read char"
,Instr "str" [Raw "RR"] ""
,Instr "str" [Raw "RR"] ""
,Instr "unlink" [] ""
,Instr "ret" [] ""
+ ,Lab "read"
]
//helper functions for the gen monad
infer e2 >>= \(s2, t2, e2_) ->
pure (compose s2 s1, TupleType (t1,t2), TupleExpr p (e1_,e2_))
- FunExpr p f args fs = //todo: fix print
+ FunExpr p f args fs =
lookup f >>= \expected ->
let accST = (\(s,ts,es) e->infer e >>= \(s_,et,e_)-> pure (compose s_ s,ts++[et],es++[e_])) in
foldM accST (zero,[],[]) args >>= \(s1, argTs, args_)->