| 1 | module Abs = Tiger_absyn |
| 2 | module Pos = Tiger_position |
| 3 | module Sym = Tiger_symbol |
| 4 | module Typ = Tiger_env_type |
| 5 | |
| 6 | type t = |
| 7 | | Invalid_syntax of Pos.t |
| 8 | | Unknown_id of {id : Sym.t; pos : Pos.t} |
| 9 | | Unknown_type of {ty_id : Sym.t; pos : Pos.t} |
| 10 | | Id_is_a_function of {id : Sym.t; pos : Pos.t} |
| 11 | | Id_not_a_function of {id : Sym.t; pos : Pos.t} |
| 12 | | No_such_field_in_record of {field : Sym.t; record : Typ.t; pos : Pos.t} |
| 13 | | Exp_not_a_record of {ty : Typ.t; pos : Pos.t} |
| 14 | | Exp_not_an_array of {ty : Typ.t; pos : Pos.t} |
| 15 | | Wrong_type of |
| 16 | { expected : Typ.t |
| 17 | ; given : Typ.t |
| 18 | ; pos : Pos.t |
| 19 | } |
| 20 | | Wrong_type_of_expression_in_var_dec of |
| 21 | { var_id : Sym.t |
| 22 | ; expected : Typ.t |
| 23 | ; given : Typ.t |
| 24 | ; pos : Pos.t |
| 25 | } |
| 26 | | Wrong_type_used_as_record of |
| 27 | { ty_id : Sym.t |
| 28 | ; ty : Typ.t |
| 29 | ; pos : Pos.t |
| 30 | } |
| 31 | | Wrong_type_used_as_array of |
| 32 | { ty_id : Sym.t |
| 33 | ; ty : Typ.t |
| 34 | ; pos : Pos.t |
| 35 | } |
| 36 | | Wrong_type_of_field_value of |
| 37 | { field_id : Sym.t |
| 38 | ; expected : Typ.t |
| 39 | ; given : Typ.t |
| 40 | ; pos : Pos.t |
| 41 | } |
| 42 | | Wrong_type_of_arg of |
| 43 | { func : Sym.t |
| 44 | ; expected : Typ.t |
| 45 | ; given : Typ.t |
| 46 | ; pos : Pos.t |
| 47 | } |
| 48 | | Wrong_number_of_args of |
| 49 | { func : Sym.t |
| 50 | ; expected : int |
| 51 | ; given : int |
| 52 | ; pos : Pos.t |
| 53 | } |
| 54 | | Invalid_operand_type of |
| 55 | { oper : Abs.oper |
| 56 | ; valid : string list |
| 57 | ; given : Typ.t |
| 58 | ; pos : Pos.t |
| 59 | } |
| 60 | | Different_operand_types of |
| 61 | { oper : Abs.oper |
| 62 | ; left : Typ.t |
| 63 | ; right : Typ.t |
| 64 | ; pos : Pos.t |
| 65 | } |
| 66 | |
| 67 | exception T of t |
| 68 | |
| 69 | val raise : t -> 'a |
| 70 | |
| 71 | val to_string : t -> string |
| 72 | |
| 73 | val is_unknown_id : t -> bool |
| 74 | val is_unknown_type : t -> bool |
| 75 | val is_wrong_type : t -> bool |
| 76 | val is_wrong_number_of_args : t -> bool |
| 77 | val is_invalid_syntax : t -> bool |
| 78 | val is_not_a_record : t -> bool |
| 79 | val is_not_an_array : t -> bool |
| 80 | val is_no_such_field_in_record : t -> bool |