Module Scm_syn


module Scm_syn: sig .. end

Variables



type var = string 
Variable

type typ =
| Real
| Int
| Single
| Double
| Extended
| Quad
Types of variables

Expressions



type unop =
| Neg
| Cast
| Sqrt
Unary operators

type binop =
| Add
| Sub
| Mul
| Div
| Mod
Binary operators

type round =
| Near
| Zero
| Up
| Down
| Rnd
Rounding direction

type scalar =
| Float of float
| Mpqf of unit (*Mpqf not supported*)

type interval = {
   mutable inf : scalar;
   mutable sup : scalar;
}
type coeff =
| Scalar of scalar
| Interval of interval

type iexpr =
| Cst of coeff
| Var of var
| Unop of unop * iexpr * typ * round
| Binop of binop * iexpr * iexpr * typ * round
User type for numerical expressions

type constyp =
| EQ
| NEQ
| GT
| GEQ
| LEQ
| LT
Numerical constraint type
type cons = iexpr * constyp * iexpr 
Numerical constraint

type bexpr =
| TRUE
| FALSE
| BRANDOM
| CONS of cons
| AND of bexpr * bexpr
| OR of bexpr * bexpr
| NOT of bexpr
Boolean expression

type point = {
   line : int;
   col : int;
   char : int;
}
Control point in the program

type taction =
| SEND
| RECEIVE

Transitions and states



type transition = {
   new_state : string; (*new state*)
   guard : bexpr; (*guard*)
   action : (int * taction * var) option; (*num channel,type, message*)
   assignement : (var * iexpr) list; (*assigment lists*)
}
Transition

type trans = {
   transition : transition; (*transition*)
   mutable tpoint : point; (*label*)
}
Labelled transition

type state = {
   id_state : string;
   ltrans : transition list;
}

Automata


type declaration = var * typ * iexpr option 
Variable declaration

type automaton = {
   id_auto : string;
   ldec : declaration list;
   init_states : string list;
   lstate : state list;
}

SCMs



type scm = {
   id_scm : string;
   nb_channels : int;
   lossy_list : int list;
   params : declaration list;
   lauto : automaton list;
   threshold : cons list;
   bad_states : (string * (string * bexpr) list) list list;
}
type global_scm = {
   gb_id_scm : string;
   gb_nb_channels : int;
   gb_lossy_list : int list;
   gb_vars : declaration list;
   gb_params : declaration list;
   gb_init_states : string list;
   gb_lstates : state list;
   gb_threshold : cons list;
   gb_bad_states : (string * bexpr) list;
}

Self-checking


exception Wrong_scm of string
val check_global_scm : global_scm -> unit
raise Wrong_scm if the automaton contains one of these errors:

Exceptions


val start_of_comment : Lexing.position Pervasives.ref
exception Error
exception Unterminated_comment of Lexing.position