(* Typed abstract syntax *) (* Some sub-expression may have to be type-checked several times. We first build the ``skeleton'' of the typed ast (basically the parsed ast with types and patterns replaced with there internal representation), then type check it. The exp_typ and br_typ fields are updated to capture all the possible values than can result from the expression or flow to the branch *) open Location type tpat = Patterns.node type ttyp = Types.node type texpr = { exp_loc : loc; mutable exp_typ : Types.descr; exp_descr : texpr'; } and texpr' = | DebugTyper of ttyp (* CDuce is a Lambda-calculus ... *) | Var of string | Apply of texpr * texpr | Abstraction of abstr (* Data constructors *) | Cst of Types.const | Pair of texpr * texpr | RecordLitt of (Types.label * texpr) list (* Data destructors *) | Op of string * texpr list | Match of texpr * branches | Map of texpr * branches | Dot of (texpr * Types.label) and abstr = { fun_name : string option; fun_iface : (Types.descr * Types.descr) list; fun_body : branches; fun_typ : Types.descr; fun_fv : string list; } and branches = { mutable br_typ : Types.descr; br_accept : Types.descr; br_branches: branch list } and branch = { mutable br_used : bool; br_pat : tpat; br_body : texpr }