2022-12-08 19:49:57 +01:00
|
|
|
type location = Lexing.position * Lexing.position
|
|
|
|
|
2022-12-07 16:45:55 +01:00
|
|
|
type ident = string
|
|
|
|
|
2022-12-08 19:49:57 +01:00
|
|
|
type real = float
|
2022-12-07 16:45:55 +01:00
|
|
|
|
2022-12-08 19:49:57 +01:00
|
|
|
type _ const =
|
|
|
|
| CReal: real -> real const
|
|
|
|
| CBool: bool -> bool const
|
|
|
|
| CInt: int -> int const
|
2022-12-07 21:56:38 +01:00
|
|
|
|
|
|
|
type monop =
|
2022-12-08 19:49:57 +01:00
|
|
|
| MOp_not | MOp_minus | MOp_pre
|
2022-12-07 21:56:38 +01:00
|
|
|
|
|
|
|
type binop =
|
|
|
|
| BOp_add | BOp_sub | BOp_mul | BOp_div | BOp_mod
|
2022-12-08 19:49:57 +01:00
|
|
|
| BOp_and | BOp_or | BOp_when
|
|
|
|
|
|
|
|
type compop =
|
|
|
|
| BOp_eq | BOp_neq
|
2022-12-07 21:56:38 +01:00
|
|
|
| BOp_le | BOp_lt | BOp_ge | BOp_gt
|
|
|
|
|
|
|
|
type triop =
|
2022-12-08 19:49:57 +01:00
|
|
|
| TOp_if | TOp_merge
|
2022-12-07 21:56:38 +01:00
|
|
|
|
2022-12-08 19:49:57 +01:00
|
|
|
type _ t_var =
|
|
|
|
| BVar: ident -> bool t_var
|
|
|
|
| IVar: ident -> int t_var
|
|
|
|
| RVar: ident -> real t_var
|
|
|
|
|
|
|
|
type _ t_expression =
|
|
|
|
| EVar: 'a t_var -> 'a t_expression
|
|
|
|
| EMonOp: monop * 'a t_expression -> 'a t_expression
|
|
|
|
| EBinOp: binop * 'a t_expression * 'a t_expression -> 'a t_expression
|
|
|
|
| ETriOp: triop * bool t_expression * 'a t_expression * 'a t_expression -> 'a t_expression
|
|
|
|
| EComp: compop * 'a t_expression * 'a t_expression -> bool t_expression
|
|
|
|
| EConst: 'a const -> 'a t_expression
|
|
|
|
| ETuple: 'a t_expression * 'b t_expression -> ('a * 'b) t_expression
|
|
|
|
| EApp: (('a -> 'b) t_node) * 'a t_expression -> 'b t_expression
|
2022-12-07 16:45:55 +01:00
|
|
|
|
2022-12-08 19:49:57 +01:00
|
|
|
and _ t_varlist =
|
|
|
|
| NVar: 'a t_varlist
|
|
|
|
| CVar: 'a t_var * 'b t_varlist -> ('a * 'b) t_varlist
|
|
|
|
|
|
|
|
and 'a t_equation = 'a t_varlist * 'a t_expression
|
|
|
|
|
|
|
|
and _ t_eqlist =
|
|
|
|
| NEql: unit t_eqlist
|
|
|
|
| CEql: 'a t_equation * 'b t_eqlist -> ('a * 'b) t_eqlist
|
|
|
|
|
|
|
|
and _ t_node =
|
|
|
|
| MakeNode:
|
|
|
|
ident
|
|
|
|
* 'i t_varlist * 'o t_varlist
|
|
|
|
* 'l t_varlist * 'e t_eqlist
|
|
|
|
-> ('i -> 'o) t_node
|
|
|
|
|
|
|
|
type _ t_nodelist =
|
|
|
|
| NNode: unit t_nodelist
|
|
|
|
| CNode: ('a -> 'b) t_node * 'c t_nodelist -> (('a -> 'b) * 'c) t_nodelist
|
|
|
|
|
|
|
|
type base_ty =
|
|
|
|
| TBool
|
|
|
|
| TInt
|
|
|
|
| TReal
|