This repository has been archived on 2022-12-27. You can view files and clone it, but cannot push or open issues or pull requests.
compilateurMIPS/baselib.ml
2022-12-09 14:45:59 +01:00

12 lines
314 B
OCaml

open Ast
open Mips
module Env = Map.Make (String)
let _types_ = Env.of_seq (List.to_seq [ "%add", Func_t (Int_t, [ Int_t; Int_t ]) ])
let builtins =
List.fold_left
(fun env (fn, impl) -> Env.add fn impl env)
Env.empty
[ "%add", [ Lw (T0, Mem (SP, 0)); Lw (T1, Mem (SP, 4)); Add (V0, T0, T1) ] ]
;;