package lustre-v6

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module LicSource

Define the Data Structure representing Compiled programs. By compiled we mean that constant are propagated, packages are instanciated, recursive node are inlined, etc.

lic = lustre internal code

Basically it is Lustre with all the suggar removed.

Définition des structures de données utilisée pour la compil, plus des utilitaires pour les messages d'erreurs, de bug etc. N.B. on utilise beaucoup l'adjectif "effectif", qui signifie simplement "correct" (c'est bizzare mais c'est ainsi.

REMARQUE GENERALE :

D'une manière générale, la compil d'une entité syntaxique "toto" est implémentée par une fonction check_toto, qui prend en entrée (entr'autre) un toto et renvoie un toto.

TYPES DE DONNEES :

  • type_ : dénotation de type effectif, implémente l'équivalence des types, construit à partir d'une type_exp.
  • const : dénotation de constante effective, construit à partir d'une val_exp => IL S'AGIT DE LA REPRESENTATION INTERNE DES CONSTANTES STATIQUES
  • var_info : déclaration de variable, construit à partir de var_info.
  • val : union entre const et var_info.
  • slice_info : dénotation de tranche de tableau, construit à partir de slice_info.
  • left : version compilée de left_part
  • eq_info : version compilée de eq_info
  • node_exp : dénotation d'opération, peut être predef ou utilisateur, construit à partir de node_exp.
  • static_arg : déclaration d'un static arg
  • pack_env : la "grosse" structure de données qui gère la compilation des packages => implémentée dans CheckGlobal pour la partie type/const/function (initialisation) et dans CheckNode pour la partie node/template qui est faite à la demande.

UTILITAIRES :

  • type_of_const : renvoie le type d'une const
  • string_of_type : pretty-print d'un type
  • string_of_const : pretty-print d'une const
  • string_of_node_key : pretty-print d'un node_key _ string_of_slice :

----------------------------------------------------------------------

Sourcetype type_ =
  1. | Bool_type_eff
  2. | Int_type_eff
  3. | Real_type_eff
  4. | External_type_eff of Lv6Id.long
  5. | Abstract_type_eff of Lv6Id.long * type_
  6. | Enum_type_eff of Lv6Id.long * Lv6Id.long list
  7. | Array_type_eff of type_ * int
  8. | Struct_type_eff of Lv6Id.long * (Lv6Id.t * (type_ * const option)) list
  9. | TypeVar of type_var
Sourceand type_var =
  1. | Any
  2. | AnyNum
Sourceand node_profile = (Lv6Id.t * type_) list * (Lv6Id.t * type_) list
Sourceand profile = type_ list * type_ list
Sourceand slice_info = {
  1. se_first : int;
  2. se_last : int;
  3. se_step : int;
  4. se_width : int;
}
Sourceand left =
  1. | LeftVarLic of var_info * Lxm.t
  2. | LeftFieldLic of left * Lv6Id.t * type_
  3. | LeftArrayLic of left * int * type_
  4. | LeftSliceLic of left * slice_info * type_
Sourceand eq_info = left list * val_exp
Sourceand val_exp = {
  1. ve_core : val_exp_core;
  2. ve_typ : type_ list;
  3. ve_clk : clock list;
  4. ve_src : Lxm.t;
}
Sourceand val_exp_core =
  1. | CallByPosLic of by_pos_op Lxm.srcflagged * val_exp list
  2. | CallByNameLic of by_name_op Lxm.srcflagged * (Lv6Id.t Lxm.srcflagged * val_exp) list
  3. | Merge of val_exp * (const Lxm.srcflagged * val_exp) list
Sourceand by_name_op =
  1. | STRUCT of Lv6Id.long
  2. | STRUCT_with of Lv6Id.long * Lv6Id.t
  3. | STRUCT_anonymous
Sourceand by_pos_op =
  1. | PREDEF_CALL of node_key Lxm.srcflagged
  2. | CALL of node_key Lxm.srcflagged
  3. | CONST_REF of Lv6Id.long
  4. | CONST of const
  5. | VAR_REF of Lv6Id.t
  6. | PRE
  7. | ARROW
  8. | FBY
  9. | CURRENT of Lv6Id.long option
  10. | WHEN of clock
  11. | TUPLE
  12. | CONCAT
  13. | HAT of int
  14. | ARRAY
  15. | STRUCT_ACCESS of Lv6Id.t
  16. | ARRAY_ACCES of int
  17. | ARRAY_SLICE of slice_info
Sourceand const =
  1. | Bool_const_eff of bool
  2. | Int_const_eff of string
  3. | Real_const_eff of string
  4. | Extern_const_eff of Lv6Id.long * type_
  5. | Abstract_const_eff of Lv6Id.long * type_ * const * bool
  6. | Enum_const_eff of Lv6Id.long * type_
  7. | Struct_const_eff of (Lv6Id.t * const) list * type_
  8. | Array_const_eff of const list * type_
  9. | Tuple_const_eff of const list
Sourceand var_info = {
  1. var_name_eff : Lv6Id.t;
  2. var_nature_eff : AstCore.var_nature;
  3. var_number_eff : int;
  4. var_type_eff : type_;
  5. var_clock_eff : id_clock;
}
Sourceand id_clock = Lv6Id.t * clock
Sourceand clock =
  1. | BaseLic
  2. | ClockVar of int
  3. | On of Lv6Id.long * Lv6Id.t * type_ * clock
Sourceand node_exp = {
  1. node_key_eff : node_key;
  2. inlist_eff : var_info list;
  3. outlist_eff : var_info list;
  4. loclist_eff : var_info list option;
  5. def_eff : node_def;
  6. has_mem_eff : bool;
  7. is_safe_eff : bool;
  8. lxm : Lxm.t;
}

node_exp correspond à une instance de template (ou, cas limite, de noeud sans param statique).

La clé est un couple ident/liste d'arguments statiques effectifs

N.B. une horloge formelle est soit None (base) soit l'index d'une entrée (0..nb entrées-1). Les formal-clocks sont créées au cours du type-checking (et pas du clock-checking)

Sourceand type_matches = (type_var * type_) list
Sourceand node_def =
  1. | ExternLic
  2. | MetaOpLic
  3. | AbstractLic of node_exp option
  4. | BodyLic of node_body
Sourceand node_body = {
  1. asserts_eff : val_exp Lxm.srcflagged list;
  2. eqs_eff : eq_info Lxm.srcflagged list;
}
Sourceand item_key = Lv6Id.long
Sourceand node_key = item_key * static_arg list
Sourceand static_arg =
  1. | ConstStaticArgLic of Lv6Id.t * const
  2. | TypeStaticArgLic of Lv6Id.t * type_
  3. | NodeStaticArgLic of Lv6Id.t * node_key
Sourceand sarg_node_eff = node_key * var_info list * var_info list
Sourceval compare_var_info : var_info -> var_info -> int
Sourcetype 'a check_flag =
  1. | Checking
  2. | Checked of 'a
  3. | Incorrect

Type check_flag

Au cours du check, on conserve le statut des idents :

  • Checking => en cours de traitement, permet de lever les récursions
  • Checked => traité et correct
  • Incorrect => déjà marqué comme incorrect (pas besoin d'un nouveau message d'erreur)
Sourceval profile_of_node_exp : node_exp -> profile
Sourceval type_are_compatible : type_ -> type_ -> bool

type_are_compatible t1 t2 checks that t1 is compatible with t2, i.e., if t1 = t2 or t1 is abstract and not t2.

Sourceval is_extern_type : type_ -> bool
Sourceval clock_are_equals : clock -> clock -> bool
Sourceval var_are_compatible : var_info -> var_info -> bool
Sourceval ident_of_type : type_ -> Lv6Id.long
Sourceval node_key_of_idref : Lv6Id.idref -> node_key
Sourceval node_key_of_ident : string -> node_key
Sourceval subst_type : type_ -> type_ -> type_
Sourceval subst_matches : type_matches -> type_ -> type_
Sourceval apply_type_matches : type_matches -> type_ list -> type_ list
Sourceval type_is_poly : type_ -> bool
Sourceval node_is_poly : node_exp -> bool
Sourceval node_is_extern : node_exp -> bool
Sourceval is_extern_const : const -> bool
Sourceval val_exp_is_constant : val_exp -> bool
Sourceval type_of_val_exp : val_exp -> type_ list
Sourceval lxm_of_val_exp : val_exp -> Lxm.t
Sourceval min_lxm : Lxm.t -> Lxm.t -> Lxm.t
Sourceval max_lxm : Lxm.t -> Lxm.t -> Lxm.t
Sourceval type_of_const : const -> type_
Sourceval types_of_const : const -> type_ list
Sourceval true_type_of_const : const -> type_
Sourceval type_of_left : left -> type_
Sourceval lxm_of_left : left -> Lxm.t
Sourceval var_info_of_left : left -> var_info
Sourceval clock_of_left : left -> clock
Sourceval string_of_ident : Lv6Id.long -> string
Sourceval string_of_type : type_ -> string
Sourceval string_of_type_list : type_ list -> string
Sourceval string_of_type_profile : (type_ list * type_ list) -> string
Sourceval string_of_clock : clock -> string
Sourceval enum_to_string : Lv6Id.long -> Lv6Id.long list -> string
Sourceval string_of_const : const -> string
Sourceval string_of_var_info : var_info -> string
Sourceval string_of_var_list : var_info list -> string
Sourceval string_of_node_key : node_key -> string
Sourceval string_of_static_arg : static_arg -> string
Sourceval string_of_type_var : type_var -> string
Sourceval string_of_type_matches : (type_var * type_) list -> string
Sourceval string_of_node_exp : node_exp -> string
Sourceval create_var_list : AstCore.var_nature -> type_ list -> var_info list
Sourceexception Compile_node_error of node_key * Lxm.t * string
Sourceexception Global_node_error of node_key * string
Sourcemodule TopoSortVarInfo : sig ... end
Sourceval sort_var_info : var_info list -> var_info list
OCaml

Innovation. Community. Security.