Minils and signature tweaked further.
This commit is contained in:
parent
50bd90183d
commit
3cc1652425
|
@ -13,7 +13,7 @@ open Static
|
||||||
|
|
||||||
(** Warning: Whenever these types are modified,
|
(** Warning: Whenever these types are modified,
|
||||||
interface_format_version should be incremented. *)
|
interface_format_version should be incremented. *)
|
||||||
let interface_format_version = "7"
|
let interface_format_version = "8"
|
||||||
|
|
||||||
(** Node argument *)
|
(** Node argument *)
|
||||||
type arg = { a_name : name option; a_type : ty }
|
type arg = { a_name : name option; a_type : ty }
|
||||||
|
@ -42,11 +42,11 @@ let mk_arg name ty = { a_type = ty; a_name = name }
|
||||||
|
|
||||||
let mk_param name = { p_name = name }
|
let mk_param name = { p_name = name }
|
||||||
|
|
||||||
|
let mk_field n ty = { f_name = n; f_type = ty }
|
||||||
|
|
||||||
|
|
||||||
let print_param ff p = Names.print_name ff p.p_name
|
let print_param ff p = Names.print_name ff p.p_name
|
||||||
|
|
||||||
let mk_field n ty =
|
|
||||||
{ f_name = n; f_type = ty }
|
|
||||||
|
|
||||||
let rec field_assoc f = function
|
let rec field_assoc f = function
|
||||||
| [] -> raise Not_found
|
| [] -> raise Not_found
|
||||||
|
|
|
@ -32,7 +32,7 @@ and tdesc =
|
||||||
| Type_struct of structure
|
| Type_struct of structure
|
||||||
|
|
||||||
and exp =
|
and exp =
|
||||||
{ e_desc: edesc; (* its descriptor *)
|
{ e_desc: edesc;
|
||||||
mutable e_ck: ck;
|
mutable e_ck: ck;
|
||||||
mutable e_ty: ty;
|
mutable e_ty: ty;
|
||||||
e_loc: location }
|
e_loc: location }
|
||||||
|
@ -40,31 +40,37 @@ and exp =
|
||||||
and edesc =
|
and edesc =
|
||||||
| Econst of static_exp
|
| Econst of static_exp
|
||||||
| Evar of ident
|
| Evar of ident
|
||||||
| Econstvar of name
|
|
||||||
| Efby of static_exp option * exp
|
| Efby of static_exp option * exp
|
||||||
|
(** static_exp fby exp *)
|
||||||
| Eapp of app * exp list * ident option
|
| Eapp of app * exp list * ident option
|
||||||
(** ident option is the optional reset *)
|
(** app ~args=(exp,exp...) reset ~r=ident *)
|
||||||
| Ewhen of exp * longname * ident
|
| Ewhen of exp * longname * ident
|
||||||
|
(** exp when Constructor(ident) *)
|
||||||
| Emerge of ident * (longname * exp) list
|
| Emerge of ident * (longname * exp) list
|
||||||
|
(** merge ident (Constructor -> exp)+ *)
|
||||||
| Estruct of (longname * exp) list
|
| Estruct of (longname * exp) list
|
||||||
|
(** { field=exp; ... } *)
|
||||||
| Eiterator of iterator_type * app * static_exp * exp list * ident option
|
| Eiterator of iterator_type * app * static_exp * exp list * ident option
|
||||||
|
(** map f <<n>> (exp,exp...) reset ident *)
|
||||||
|
|
||||||
and app = { a_op: op; a_params: static_exp list }
|
and app = { a_op: op; a_params: static_exp list; a_unsafe: bool }
|
||||||
|
(** Unsafe applications could have side effects
|
||||||
|
and be delicate about optimizations, !be careful! *)
|
||||||
|
|
||||||
and op =
|
and op =
|
||||||
| Efun of longname
|
| Etuple (** (args) *)
|
||||||
| Enode of longname
|
| Efun of longname (** "Stateless" longname <<a_params>> (args) reset r *)
|
||||||
| Eifthenelse
|
| Enode of longname (** "Stateful" longname <<a_params>> (args) reset r *)
|
||||||
| Efield_update of longname (* field name args would be [record ; value] *)
|
| Eifthenelse (** if arg1 then arg2 else arg3 *)
|
||||||
| Efield of longname
|
| Efield of longname (** arg1.longname *)
|
||||||
| Earray
|
| Efield_update of longname (** { arg1 with longname = arg2 } *)
|
||||||
| Etuple
|
| Earray (** [ args ] *)
|
||||||
| Erepeat
|
| Earray_fill (** [arg1^arg2] *)
|
||||||
| Eselect
|
| Eselect (** arg1[a_params] *)
|
||||||
| Eselect_dyn
|
| Eselect_slice (** arg1[a_param1..a_param2] *)
|
||||||
| Eupdate
|
| Eselect_dyn (** arg1.[arg3...] default arg2 *)
|
||||||
| Eselect_slice
|
| Eupdate (** [ arg1 with a_params = arg2 ] *)
|
||||||
| Econcat
|
| Econcat (** arg1@@arg2 *)
|
||||||
|
|
||||||
and ct =
|
and ct =
|
||||||
| Ck of ck
|
| Ck of ck
|
||||||
|
@ -105,8 +111,7 @@ type contract =
|
||||||
c_enforce : exp;
|
c_enforce : exp;
|
||||||
c_controllables : var_dec list;
|
c_controllables : var_dec list;
|
||||||
c_local : var_dec list;
|
c_local : var_dec list;
|
||||||
c_eq : eq list;
|
c_eq : eq list }
|
||||||
}
|
|
||||||
|
|
||||||
type node_dec =
|
type node_dec =
|
||||||
{ n_name : name;
|
{ n_name : name;
|
||||||
|
@ -123,14 +128,14 @@ type node_dec =
|
||||||
type const_dec =
|
type const_dec =
|
||||||
{ c_name : name;
|
{ c_name : name;
|
||||||
c_value : static_exp;
|
c_value : static_exp;
|
||||||
c_loc : location; }
|
c_loc : location }
|
||||||
|
|
||||||
type program =
|
type program =
|
||||||
{ p_pragmas: (name * string) list;
|
{ p_pragmas: (name * string) list;
|
||||||
p_opened : name list;
|
p_opened : name list;
|
||||||
p_types : type_dec list;
|
p_types : type_dec list;
|
||||||
p_nodes : node_dec list;
|
p_nodes : node_dec list;
|
||||||
p_consts : const_dec list; }
|
p_consts : const_dec list }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue