(* Hindley milner type checking *) open Ast (* Get a list of name -> type mappings of all the declarations to be used as a base type map for type checking *) let rec get_decl_map (program:program) : (string, ty) Hashtbl.t = let get_decl_sig (decl:decl) : string * ty = match decl with | DeclFunc func -> (func.name, TyFunc ([], TyUnit)) | DeclExternFunc extern -> (extern.name, TyUnit) in match program with | [] -> Hashtbl.create 100 | hd :: tl -> let (name, ty) = get_decl_sig hd in let next = get_decl_map tl in Hashtbl.add next name ty; next type state = { decls : (string, ty) Hashtbl.t ; func_sig : string ; stmts : stmt list } (* let rec typeck (state:state) : state = let typeck_stmt *)