Skip to content
Snippets Groups Projects
predefSemantics.mli 1.68 KiB
(** Time-stamp: <modified the 26/05/2008 (at 14:57) by Erwan Jahier> *)

(** 
    As far as predefined operators are concerned, typing, clock checking, and constant
    evaluation are very similar tasks. It consists in:

    - checking the arity
    - checking (recursively) the arguments
    - apply a rule associated to the operator that says, given a list 
      of checked arguments, what is the "result" of the operator call.

    That's why we gathered those three activities in this module.

    nb: the whole operational semantics of predefined operators is
    defined by this module.
*)


(** An evaluator  returns a list because Lustre calls returns tuples. 
    
    SE: migth raise some check error!
*)
type 'a evaluator = 'a list list -> 'a list 

open CompiledData

type typer = type_eff evaluator
type const_evaluator = const_eff evaluator
type clocker = clock_eff evaluator


exception EvalConst_error of string
exception EvalType_error of string

(* That function says how to statically evaluate constants *)
val const_eval: 
  Predef.op -> Lxm.t -> CompiledData.static_arg_eff list -> const_evaluator

(*  Provides the type profile of predef operators. More precisely, given an operator
    and a list of types, This function checks that the provided types are ok, and
    returns the list of the operator output types.
*)
val type_eval: 
  Predef.op -> Lxm.t -> CompiledData.static_arg_eff list -> typer
  
val type_error_const : const_eff list -> string -> 'a
val type_error : type_eff list -> string -> 'a

val arity_error_const : const_eff list -> string -> 'a
val arity_error : type_eff list -> string -> 'a


val make_node_exp_eff : Predef.op -> Lxm.t -> static_arg_eff list -> node_exp_eff