2022-12-09 14:26:28 +01:00
|
|
|
exception MyTypeError of string
|
|
|
|
|
2022-12-08 19:49:57 +01:00
|
|
|
type location = Lexing.position * Lexing.position
|
|
|
|
|
2022-12-09 14:26:28 +01:00
|
|
|
type real = float
|
|
|
|
|
2022-12-07 16:45:55 +01:00
|
|
|
type ident = string
|
|
|
|
|
2022-12-09 14:26:28 +01:00
|
|
|
type base_ty =
|
|
|
|
| TBool
|
|
|
|
| TInt
|
|
|
|
| TReal
|
2022-12-07 16:45:55 +01:00
|
|
|
|
2022-12-09 14:26:28 +01:00
|
|
|
type const =
|
|
|
|
| CReal of real
|
|
|
|
| CBool of bool
|
|
|
|
| CInt of int
|
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-09 14:26:28 +01:00
|
|
|
| BOp_and | BOp_or | BOp_arrow
|
2022-12-08 19:49:57 +01:00
|
|
|
|
|
|
|
type compop =
|
2022-12-09 14:26:28 +01:00
|
|
|
| COp_eq | COp_neq
|
|
|
|
| COp_le | COp_lt | COp_ge | COp_gt
|
2022-12-07 21:56:38 +01:00
|
|
|
|
|
|
|
type triop =
|
2022-12-08 19:49:57 +01:00
|
|
|
| TOp_if | TOp_merge
|
2022-12-07 21:56:38 +01:00
|
|
|
|
2022-12-09 14:26:28 +01:00
|
|
|
type t_var =
|
|
|
|
| BVar of ident
|
|
|
|
| IVar of ident
|
|
|
|
| RVar of ident
|
|
|
|
|
2022-12-10 17:14:54 +01:00
|
|
|
type full_ty = base_ty list
|
2022-12-09 16:33:07 +01:00
|
|
|
|
2022-12-09 14:26:28 +01:00
|
|
|
type t_expression =
|
2022-12-09 16:33:07 +01:00
|
|
|
| EVar of full_ty * t_var
|
|
|
|
| EMonOp of full_ty * monop * t_expression
|
|
|
|
| EBinOp of full_ty * binop * t_expression * t_expression
|
|
|
|
| ETriOp of full_ty * triop * t_expression * t_expression * t_expression
|
|
|
|
| EComp of full_ty * compop * t_expression * t_expression
|
|
|
|
| EWhen of full_ty * t_expression * t_expression
|
2022-12-10 02:18:04 +01:00
|
|
|
| EReset of full_ty * t_expression * t_expression
|
2022-12-09 16:33:07 +01:00
|
|
|
| EConst of full_ty * const
|
|
|
|
| ETuple of full_ty * (t_expression list)
|
|
|
|
| EApp of full_ty * t_node * t_expression
|
2022-12-13 11:45:40 +01:00
|
|
|
| EAuto of full_ty * t_state * t_state list (* initial state and transitions *)
|
2022-12-09 16:33:07 +01:00
|
|
|
|
|
|
|
and t_varlist = full_ty * (t_var list)
|
2022-12-09 14:26:28 +01:00
|
|
|
|
|
|
|
and t_equation = t_varlist * t_expression
|
|
|
|
|
|
|
|
and t_eqlist = t_equation list
|
|
|
|
|
2022-12-13 11:45:40 +01:00
|
|
|
and t_state = | State of ident * t_eqlist * t_expression * ident
|
|
|
|
|
2022-12-09 14:26:28 +01:00
|
|
|
and t_node =
|
|
|
|
{
|
|
|
|
n_name : ident;
|
|
|
|
n_inputs: t_varlist;
|
|
|
|
n_outputs: t_varlist;
|
|
|
|
n_local_vars: t_varlist;
|
|
|
|
n_equations: t_eqlist;
|
2022-12-10 17:14:54 +01:00
|
|
|
n_inputs_type : full_ty;
|
|
|
|
n_outputs_type : full_ty;
|
2022-12-09 14:26:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type t_nodelist = t_node list
|
|
|
|
|