Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let env_program (prog : NAst.program) : Types.type_env =
- let lcn = list_canonical_names prog in
- let fcd = first_canonical_duplicate lcn in
- if Option.is_some(fcd)
- then
- let fcd' = Option.get fcd in
- raise(error_duplicate_variable
- (CanonicalName.to_string
- (fcd'.NAst.source_file_decl.NAst.type_canonical_name))
- fcd'.NAst.source_file_decl.NAst.type_pos)
- else
- let m = TEnv.empty in
- match prog with
- | [] -> m
- | _ -> List.fold_left
- (fun map sf ->
- TEnv.add
- sf.NAst.source_file_decl.NAst.type_canonical_name
- (env_type_decl sf.NAst.source_file_decl info)
- map)
- m
- prog
Add Comment
Please, Sign In to add comment