mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-09 22:16:10 +03:00
cleanup dcalc-ast.ml
This commit is contained in:
parent
f8343d1d0c
commit
6da5cc518b
@ -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)
|
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
|
type struct_name = StructName.t
|
||||||
|
|
||||||
@ -40,12 +40,12 @@ type enum_name = EnumName.t
|
|||||||
|
|
||||||
type typ =
|
type typ =
|
||||||
| TLit of typ_lit
|
| TLit of typ_lit
|
||||||
| TTuple of typ Pos.marked list * (struct_name[@opaque]) option
|
| TTuple of typ Pos.marked list * (struct_name) option
|
||||||
| TEnum of typ Pos.marked list * (enum_name[@opaque])
|
| TEnum of typ Pos.marked list * (enum_name)
|
||||||
| TArrow of typ Pos.marked * typ Pos.marked
|
| TArrow of typ Pos.marked * typ Pos.marked
|
||||||
| TArray of typ Pos.marked
|
| TArray of typ Pos.marked
|
||||||
| TAny
|
| TAny
|
||||||
[@@deriving show]
|
|
||||||
|
|
||||||
type date = Runtime.date
|
type date = Runtime.date
|
||||||
|
|
||||||
@ -67,9 +67,9 @@ type lit =
|
|||||||
| LDate of date
|
| LDate of date
|
||||||
| LDuration of duration
|
| 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 =
|
type binop =
|
||||||
| And
|
| And
|
||||||
@ -88,39 +88,38 @@ type binop =
|
|||||||
| Map
|
| Map
|
||||||
| Concat
|
| Concat
|
||||||
| Filter
|
| 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 =
|
type unop =
|
||||||
| Not
|
| Not
|
||||||
| Minus of op_kind
|
| Minus of op_kind
|
||||||
| Log of log_entry * (Utils.Uid.MarkedString.info list[@opaque])
|
| Log of log_entry * (Utils.Uid.MarkedString.info list)
|
||||||
| Length
|
| Length
|
||||||
| IntToRat
|
| IntToRat
|
||||||
| GetDay
|
| GetDay
|
||||||
| GetMonth
|
| GetMonth
|
||||||
| GetYear
|
| 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 =
|
type expr =
|
||||||
| EVar of (expr Bindlib.var[@opaque]) Pos.marked
|
| EVar of (expr Bindlib.var) Pos.marked
|
||||||
| ETuple of expr Pos.marked list * (struct_name[@opaque]) option
|
| ETuple of expr Pos.marked list * (struct_name) option
|
||||||
| ETupleAccess of expr Pos.marked * int * (struct_name[@opaque]) option * typ Pos.marked list
|
| ETupleAccess of expr Pos.marked * int * (struct_name) option * typ Pos.marked list
|
||||||
| EInj of expr Pos.marked * int * (enum_name[@opaque]) * 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[@opaque])
|
| EMatch of expr Pos.marked * expr Pos.marked list * (enum_name)
|
||||||
| EArray of expr Pos.marked list
|
| EArray of expr Pos.marked list
|
||||||
| ELit of (lit[@opaque])
|
| ELit of (lit)
|
||||||
| EAbs of ((expr, expr Pos.marked) Bindlib.mbinder[@opaque]) Pos.marked * typ Pos.marked list
|
| EAbs of ((expr, expr Pos.marked) Bindlib.mbinder) Pos.marked * typ Pos.marked list
|
||||||
| EApp of expr Pos.marked * expr Pos.marked list
|
| EApp of expr Pos.marked * expr Pos.marked list
|
||||||
| EAssert of expr Pos.marked
|
| EAssert of expr Pos.marked
|
||||||
| EOp of operator
|
| EOp of operator
|
||||||
| EDefault of expr Pos.marked list * expr Pos.marked * expr Pos.marked
|
| EDefault of expr Pos.marked list * expr Pos.marked * expr Pos.marked
|
||||||
| EIfThenElse of expr Pos.marked * expr Pos.marked * expr Pos.marked
|
| EIfThenElse of expr Pos.marked * expr Pos.marked * expr Pos.marked
|
||||||
| ErrorOnEmpty of expr Pos.marked
|
| ErrorOnEmpty of expr Pos.marked
|
||||||
[@@deriving show]
|
|
||||||
|
|
||||||
type struct_ctx = (StructFieldName.t * typ Pos.marked) list StructMap.t
|
type struct_ctx = (StructFieldName.t * typ Pos.marked) list StructMap.t
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ module EnumMap : Map.S with type key = EnumName.t
|
|||||||
|
|
||||||
(** {1 Abstract syntax tree} *)
|
(** {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 =
|
type typ =
|
||||||
| TLit of typ_lit
|
| TLit of typ_lit
|
||||||
@ -41,7 +41,7 @@ type typ =
|
|||||||
| TArrow of typ Pos.marked * typ Pos.marked
|
| TArrow of typ Pos.marked * typ Pos.marked
|
||||||
| TArray of typ Pos.marked
|
| TArray of typ Pos.marked
|
||||||
| TAny
|
| TAny
|
||||||
[@@deriving show]
|
|
||||||
|
|
||||||
type date = Runtime.date
|
type date = Runtime.date
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ type unop =
|
|||||||
| GetMonth
|
| GetMonth
|
||||||
| GetYear
|
| 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
|
(** The expressions use the {{:https://lepigre.fr/ocaml-bindlib/} Bindlib} library, based on
|
||||||
higher-order abstract syntax*)
|
higher-order abstract syntax*)
|
||||||
@ -125,7 +125,7 @@ type expr =
|
|||||||
| EDefault of expr Pos.marked list * expr Pos.marked * expr Pos.marked
|
| EDefault of expr Pos.marked list * expr Pos.marked * expr Pos.marked
|
||||||
| EIfThenElse of expr Pos.marked * expr Pos.marked * expr Pos.marked
|
| EIfThenElse of expr Pos.marked * expr Pos.marked * expr Pos.marked
|
||||||
| ErrorOnEmpty of expr Pos.marked
|
| ErrorOnEmpty of expr Pos.marked
|
||||||
[@@deriving show]
|
|
||||||
|
|
||||||
type struct_ctx = (StructFieldName.t * typ Pos.marked) list StructMap.t
|
type struct_ctx = (StructFieldName.t * typ Pos.marked) list StructMap.t
|
||||||
|
|
||||||
|
@ -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_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 ->
|
expr Pos.marked Bindlib.box ->
|
||||||
expr Pos.marked Bindlib.box ->
|
expr Pos.marked Bindlib.box ->
|
||||||
|
Loading…
Reference in New Issue
Block a user