X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;ds=sidebyside;f=compiler%2Fsrc%2Flib%2Ftiger%2Ftiger_env.ml;fp=compiler%2Fsrc%2Flib%2Ftiger%2Ftiger_env.ml;h=f698f89563175a094cdcc27f02e17cf85cc0b076;hb=c0bdf964d389a2b9465fad44aa1f1f849c72140f;hp=0000000000000000000000000000000000000000;hpb=b762cacb0f9df0b034bb75e67c4b64151e338e92;p=tiger.ml.git diff --git a/compiler/src/lib/tiger/tiger_env.ml b/compiler/src/lib/tiger/tiger_env.ml new file mode 100644 index 0000000..f698f89 --- /dev/null +++ b/compiler/src/lib/tiger/tiger_env.ml @@ -0,0 +1,25 @@ +module Map = Tiger_map +module Type = Tiger_env_type +module Value = Tiger_env_value + +type t = + { typs : Type.env + ; vals : Value.env + } + +let base = + { typs = Type.built_in + ; vals = Value.built_in + } + +let get_typ {typs; _} k = + Map.get typs ~k + +let get_val {vals; _} k = + Map.get vals ~k + +let set_typ t k v = + {t with typs = Map.set t.typs ~k ~v} + +let set_val t k v = + {t with vals = Map.set t.vals ~k ~v}