Module Ast_ml

type tok = Parse_info.t
type 'a wrap = 'a * tok
type 'a bracket = tok * 'a * tok
type ident = string wrap
type name = qualifier * ident
and qualifier = ident list
type type_ =
| TyName of name
| TyVar of ident
| TyFunction of type_ * type_
| TyApp of type_ list * name
| TyTuple of type_ list
type expr =
| L of literal
| Name of name
| Constructor of name * expr option
| Tuple of expr list
| List of expr list bracket
| Sequence of expr list
| Prefix of string wrap * expr
| Infix of expr * string wrap * expr
| Call of expr * argument list
| RefAccess of tok * expr
| RefAssign of expr * tok * expr
| FieldAccess of expr * tok * name
| FieldAssign of expr * tok * name * tok * expr
| Record of expr option * (name * expr) list bracket
| New of tok * name
| ObjAccess of expr * tok * ident
| LetIn of let_binding list * expr * rec_opt
| Fun of parameter list * expr
| Nop
| If of tok * expr * expr * expr
| Match of expr * match_case list
| Try of tok * expr * match_case list
| While of tok * expr * expr
| For of tok * ident * expr * for_direction * expr * expr
and literal =
| Int of string wrap
| Float of string wrap
| Char of string wrap
| String of string wrap
and argument =
| Arg of expr
| ArgKwd of ident * expr
| ArgQuestion of ident * expr
and match_case = pattern * match_action
and match_action = expr * expr option
and for_direction =
| To of tok
| Downto of tok
and rec_opt = tok option
and pattern =
| PatVar of ident
| PatLiteral of literal
| PatConstructor of name * pattern option
| PatConsInfix of pattern * tok * pattern
| PatTuple of pattern list
| PatList of pattern list bracket
| PatUnderscore of tok
| PatRecord of (name * pattern) list bracket
| PatAs of pattern * ident
| PatDisj of pattern * pattern
| PatTyped of pattern * type_
and let_binding =
| LetClassic of let_def
| LetPattern of pattern * expr
and let_def = {
lname : ident;
lparams : parameter list;
lbody : expr;
}
and parameter = pattern
type type_declaration = {
tname : ident;
tparams : type_parameter list;
tbody : type_def_kind;
}
and type_parameter = ident
and type_def_kind =
| AbstractType
| CoreType of type_
| AlgebricType of (ident * type_ list) list
| RecordType of (ident * type_ * tok option) list bracket
type module_declaration = {
mname : ident;
mbody : module_expr;
}
and module_expr =
| ModuleName of name
| ModuleStruct of item list
and item =
| Type of type_declaration list
| Exception of ident * type_ list
| External of ident * type_ * string wrap list
| Open of name
| Val of ident * type_
| Let of rec_opt * let_binding list
| Module of module_declaration
type program = item list
type any =
| T of type_
| E of expr
| P of pattern
| I of item
| Pr of program
val str_of_ident : ('a * 'b) -> 'a
val info_of_ident : ('a * 'b) -> 'b
val ident_of_name : ('a * 'b) -> 'b
val qualifier_of_name : ((string * 'a) list * 'b) -> string