diff --git a/compiler/dcalc/ast.ml b/compiler/dcalc/ast.ml index ec1544f3..572ed0d3 100644 --- a/compiler/dcalc/ast.ml +++ b/compiler/dcalc/ast.ml @@ -32,7 +32,7 @@ module EnumConstructor : Uid.Id with type info = Uid.MarkedString.info = module EnumMap : Map.S with type key = EnumName.t = Map.Make (EnumName) -type typ_lit = TBool | TUnit | TInt | TRat | TMoney | TDate | TDuration [@@deriving show] +type typ_lit = TBool | TUnit | TInt | TRat | TMoney | TDate | TDuration type struct_name = StructName.t @@ -40,12 +40,12 @@ type enum_name = EnumName.t type typ = | TLit of typ_lit - | TTuple of typ Pos.marked list * (struct_name[@opaque]) option - | TEnum of typ Pos.marked list * (enum_name[@opaque]) + | TTuple of typ Pos.marked list * (struct_name) option + | TEnum of typ Pos.marked list * (enum_name) | TArrow of typ Pos.marked * typ Pos.marked | TArray of typ Pos.marked | TAny -[@@deriving show] + type date = Runtime.date @@ -67,9 +67,9 @@ type lit = | LDate of date | LDuration of duration -type op_kind = KInt | KRat | KMoney | KDate | KDuration [@@deriving show] +type op_kind = KInt | KRat | KMoney | KDate | KDuration -type ternop = Fold [@@deriving show] +type ternop = Fold type binop = | And @@ -88,39 +88,38 @@ type binop = | Map | Concat | Filter -[@@deriving show] -type log_entry = VarDef of typ | BeginCall | EndCall | PosRecordIfTrueBool [@@deriving show] +type log_entry = VarDef of typ | BeginCall | EndCall | PosRecordIfTrueBool type unop = | Not | Minus of op_kind - | Log of log_entry * (Utils.Uid.MarkedString.info list[@opaque]) + | Log of log_entry * (Utils.Uid.MarkedString.info list) | Length | IntToRat | GetDay | GetMonth | GetYear -[@@deriving show] -type operator = Ternop of ternop | Binop of binop | Unop of unop [@@deriving show] + +type operator = Ternop of ternop | Binop of binop | Unop of unop type expr = - | EVar of (expr Bindlib.var[@opaque]) Pos.marked - | ETuple of expr Pos.marked list * (struct_name[@opaque]) option - | ETupleAccess of expr Pos.marked * int * (struct_name[@opaque]) option * typ Pos.marked list - | EInj of expr Pos.marked * int * (enum_name[@opaque]) * typ Pos.marked list - | EMatch of expr Pos.marked * expr Pos.marked list * (enum_name[@opaque]) + | EVar of (expr Bindlib.var) Pos.marked + | ETuple of expr Pos.marked list * (struct_name) option + | ETupleAccess of expr Pos.marked * int * (struct_name) option * typ Pos.marked list + | EInj of expr Pos.marked * int * (enum_name) * typ Pos.marked list + | EMatch of expr Pos.marked * expr Pos.marked list * (enum_name) | EArray of expr Pos.marked list - | ELit of (lit[@opaque]) - | EAbs of ((expr, expr Pos.marked) Bindlib.mbinder[@opaque]) Pos.marked * typ Pos.marked list + | ELit of (lit) + | EAbs of ((expr, expr Pos.marked) Bindlib.mbinder) Pos.marked * typ Pos.marked list | EApp of expr Pos.marked * expr Pos.marked list | EAssert of expr Pos.marked | EOp of operator | EDefault of expr Pos.marked list * expr Pos.marked * expr Pos.marked | EIfThenElse of expr Pos.marked * expr Pos.marked * expr Pos.marked | ErrorOnEmpty of expr Pos.marked -[@@deriving show] + type struct_ctx = (StructFieldName.t * typ Pos.marked) list StructMap.t diff --git a/compiler/dcalc/ast.mli b/compiler/dcalc/ast.mli index 0a454710..f18731b7 100644 --- a/compiler/dcalc/ast.mli +++ b/compiler/dcalc/ast.mli @@ -32,7 +32,7 @@ module EnumMap : Map.S with type key = EnumName.t (** {1 Abstract syntax tree} *) -type typ_lit = TBool | TUnit | TInt | TRat | TMoney | TDate | TDuration [@@deriving show] +type typ_lit = TBool | TUnit | TInt | TRat | TMoney | TDate | TDuration type typ = | TLit of typ_lit @@ -41,7 +41,7 @@ type typ = | TArrow of typ Pos.marked * typ Pos.marked | TArray of typ Pos.marked | TAny -[@@deriving show] + type date = Runtime.date @@ -102,7 +102,7 @@ type unop = | GetMonth | GetYear -type operator = Ternop of ternop | Binop of binop | Unop of unop [@@deriving show] +type operator = Ternop of ternop | Binop of binop | Unop of unop (** The expressions use the {{:https://lepigre.fr/ocaml-bindlib/} Bindlib} library, based on higher-order abstract syntax*) @@ -125,7 +125,7 @@ type expr = | EDefault of expr Pos.marked list * expr Pos.marked * expr Pos.marked | EIfThenElse of expr Pos.marked * expr Pos.marked * expr Pos.marked | ErrorOnEmpty of expr Pos.marked -[@@deriving show] + type struct_ctx = (StructFieldName.t * typ Pos.marked) list StructMap.t diff --git a/compiler/lcalc/ast.mli b/compiler/lcalc/ast.mli index 15350081..f16f6b15 100644 --- a/compiler/lcalc/ast.mli +++ b/compiler/lcalc/ast.mli @@ -107,7 +107,7 @@ val make_some : expr Pos.marked Bindlib.box -> expr Pos.marked Bindlib.box val make_some' : expr Pos.marked -> expr -val make_matchopt_dumb : +val make_matchopt_with_abs_arms : expr Pos.marked Bindlib.box -> expr Pos.marked Bindlib.box -> expr Pos.marked Bindlib.box ->