diff --git a/baselib.ml b/baselib.ml index f4e9958..94cd2e5 100644 --- a/baselib.ml +++ b/baselib.ml @@ -9,7 +9,9 @@ let _types_ = ; "%sub", Func_t (Int_t, [ Int_t; Int_t ]) ; "%mul", Func_t (Int_t, [ Int_t; Int_t ]) ; "%div", Func_t (Int_t, [ Int_t; Int_t ]) - ; "puti", Func_t (Int_t, [ Int_t ]) + ; "puti", Func_t (Void_t, [ Int_t ]) + ; "puts", Func_t (Void_t, [ Str_t ]) + ; "geti", Func_t (Int_t, []) ]) ;; @@ -22,5 +24,7 @@ let builtins = ; "%mul", [ Lw (T0, Mem (SP, 4)); Lw (T1, Mem (SP, 0)); Mul (V0, T0, T1) ] ; "%div", [ Lw (T0, Mem (SP, 4)); Lw (T1, Mem (SP, 0)); Div (V0, T0, T1) ] ; "puti", [ Lw (A0, Mem (SP, 0)); Li (V0, Syscall.print_int); Syscall ] + ; "puts", [ Lw (A0, Mem (SP, 0)); Li (V0, Syscall.print_str); Syscall ] + ; "geti", [ Lw (A0, Mem (SP, 0)); Li (V0, Syscall.read_int); Syscall ] ] ;;