Implementing type equation generator in OCaml
问题 type exp = | CONST of int | VAR of var | ADD of exp * exp | SUB of exp * exp | ISZERO of exp | IF of exp * exp * exp | LET of var * exp * exp | PROC of var * exp | CALL of exp * exp and var = string type typ = TyInt | TyBool | TyFun of typ * typ | TyVar of tyvar and tyvar = string type typ_eqn = (typ * typ) list module TEnv = struct type t = var -> typ let empty = fun _ -> raise (Failure "Type Env is empty") let extend (x,t) tenv = fun y -> if x = y then t else (tenv y) let find tenv x = tenv