Newer
Older
(** Time-stamp: <modified the 19/05/2008 (at 17:28) by Erwan Jahier> *)
(** (Raw) Abstract syntax tree of source programs. *)
open Lxm
(**********************************************************************************)
type clock_exp =
| BaseClock
| NamedClock of Ident.t (* XXX should be Ident.idref !!!*) srcflagged
(**********************************************************************************)
(** [type_exp] is used to type flow, parameters, constants. *)
and
type_exp_core =
| Bool_type_exp
| Int_type_exp
| Real_type_exp
| Named_type_exp of Ident.idref
| Array_type_exp of (type_exp * val_exp)
and node_info = {
name : Ident.t;
vars : node_vars option; (* aliased node may have no i/o decl *)
def : node_def;
has_mem : bool;
is_safe : bool;
}
| StaticParamNode of
(Ident.t * var_info srcflagged list * var_info srcflagged list * has_mem_flag)
and node_vars = {
inlist : Ident.t list;
outlist : Ident.t list;
loclist : Ident.t list option; (* abstract/ext node have no body *)
vartable: var_info_table;
and var_info_table = (Ident.t, var_info srcflagged) Hashtbl.t
var_nature : var_nature;
var_name : Ident.t;
var_type : type_exp;
var_clock : clock_exp
}
and var_nature =
| VarInput
| VarOutput
| VarLocal
and node_def =
| Extern
| Abstract
| Body of node_body
| Alias of node_exp srcflagged
and node_body = {
asserts : (val_exp srcflagged) list;
eqs : (eq_info srcflagged) list;
}
and has_mem_flag = bool
| LeftVar of (Ident.t srcflagged)
| LeftField of (left_part * (Ident.t srcflagged))
| LeftArray of (left_part * (val_exp srcflagged))
| LeftSlice of (left_part * (slice_info srcflagged))
and slice_info = {
si_first : val_exp ;
si_last : val_exp ;
si_step : val_exp option ;
}
and by_pos_op =
| Predef of Predef.op * static_arg srcflagged list
| CALL_n of node_exp srcflagged
| PRE_n
| ARROW_n
| FBY_n
| CURRENT_n
| CONCAT_n
| HAT_n
| ARRAY_n
| STRUCT_ACCESS_n of Ident.t
| ARRAY_ACCES_n of val_exp
| ARRAY_SLICE_n of slice_info
| MERGE_n of (Ident.t * (Ident.t list))
(************************************************)
(* Info associées aux expressions *)
(************************************************)
(* Vision "fonctionnelle" des val_exp : *)
(* Une exp. est une application d'operation : *)
(* - avec passage par position, auquel cas les *)
(* opérandes sont des val_exp *)
(* - avec passage par nom, auquel cas les *)
(* opérandes sont des Ident.t * val_exp *)
(************************************************)
(* and val_exp = by_pos_op srcflagged * operands *)
| CallByPos of (by_pos_op srcflagged * operands)
| CallByName of (by_name_op srcflagged * (Ident.t srcflagged * val_exp) list)
(* XXX virer cet Oper ? *)
| STRUCT_anonymous_n
(* for backward compatibility with lv4 *)
(Ident.idref * (static_arg srcflagged list))
(** Params statiques effectifs :
- val_exp (pour les constantes)
- type_exp (pour les types)
- node_exp (pour les node)
- ident : a résoudre, peut etre const, type ou node
*)
and static_arg =
| StaticArgIdent of Ident.idref
| StaticArgConst of val_exp
| StaticArgType of type_exp
| StaticArgNode of node_exp
(* | StaticArgFunc of node_exp *)
(**********************************************************************************)
(** constant *)
type const_info =
| ExternalConst of (Ident.t * type_exp)
| EnumConst of (Ident.t * type_exp)
| DefinedConst of (Ident.t * type_exp option * val_exp)
(** Type *)
type field_info = {
fd_name : Ident.t ;
fd_type : type_exp ;
fd_value : val_exp option
}
type struct_type_info = {
st_name : Ident.t ;
st_flist : Ident.t list; (* field name list *)
st_ftable : (Ident.t, field_info srcflagged) Hashtbl.t
}
type type_info =
| ExternalType of (Ident.t)
| AliasedType of (Ident.t * type_exp)
| EnumType of (Ident.t * Ident.t srcflagged list)
| StructType of struct_type_info
| ArrayType of (Ident.t * type_exp * val_exp)
(** Operator *)
type item_ident =
| ConstItem of Ident.t
| TypeItem of Ident.t
| NodeItem of Ident.t * static_param srcflagged list
type item_info =
ConstInfo of const_info
| TypeInfo of type_info