Mlang.Com
module CatVar : sig ... end
Here are all the types a value can have. Date types don't seem to be used at all though.
type loc_tgv = {
loc_id : string; |
loc_cat : CatVar.loc; |
loc_idx : int; |
loc_cat_id : CatVar.t; |
loc_cat_str : string; |
loc_cat_idx : int; |
loc_int : int; |
}
type loc =
| LocTgv of string * loc_tgv |
| LocTmp of string * int |
| LocRef of string * int |
| LocArg of string * int |
| LocRes of string |
module Var : sig ... end
module DomainIdSet :
SetSetExt.T with type base_elt = string and type elt = DomainId.t
module DomainIdMap : MapExt.T with type key = DomainId.t
type 'a domain = {
dom_id : DomainId.t Pos.marked; |
dom_names : Pos.t DomainIdMap.t; |
dom_by_default : bool; |
dom_min : DomainIdSet.t; |
dom_max : DomainIdSet.t; |
dom_rov : IntSet.t; |
dom_data : 'a; |
dom_used : int Pos.marked option; |
}
type rule_domain = rule_domain_data domain
type verif_domain = verif_domain_data domain
The M language has an extremely odd way to specify looping. Rather than having first-class local mutable variables whose value change at each loop iteration, the M language prefers to use the changing loop parameter to instantiate the variable names inside the loop. For instance,
somme(i=1..10:Xi)
should evaluate to the sum of variables X1
, X2
, etc. Parameters can be number or characters and there can be multiple of them. We have to store all this information.
Values that can be substituted for loop parameters
type 'v set_value_loop =
| Single of 'v atom Pos.marked |
| Range of 'v atom Pos.marked * 'v atom Pos.marked |
| Interval of 'v atom Pos.marked * 'v atom Pos.marked |
type 'v loop_variable = char Pos.marked * 'v set_value_loop list
A loop variable is the character that should be substituted in variable names inside the loop plus the set of value to substitute.
There are two kind of loop variables declaration, but they are semantically the same though they have different concrete syntax.
type 'v set_value =
| FloatValue of float Pos.marked |
| VarValue of 'v Pos.marked |
| Interval of int Pos.marked * int Pos.marked |
type func =
type 'v expression =
| TestInSet of bool * 'v m_expression * 'v set_value list | (* Test if an expression is in a set of value (or not in the set if the flag is set to |
| Unop of unop * 'v m_expression | |
| Comparison of comp_op Pos.marked * 'v m_expression * 'v m_expression | |
| Binop of binop Pos.marked * 'v m_expression * 'v m_expression | |
| Index of 'v Pos.marked * 'v m_expression | |
| Conditional of 'v m_expression * 'v m_expression * 'v m_expression option | |
| FuncCall of func Pos.marked * 'v m_expression list | |
| FuncCallLoop of func Pos.marked
* 'v loop_variables Pos.marked
* 'v m_expression | |
| Literal of literal | |
| Var of 'v | |
| Loop of 'v loop_variables Pos.marked * 'v m_expression | (* The loop is prefixed with the loop variables declarations *) |
| NbCategory of Pos.t CatVar.Map.t | |
| Attribut of 'v Pos.marked * string Pos.marked | |
| Size of 'v Pos.marked | |
| NbAnomalies | |
| NbDiscordances | |
| NbInformatives | |
| NbBloquantes |
and 'v m_expression = 'v expression Pos.marked
module Error : sig ... end
type 'v print_arg =
| PrintString of string |
| PrintName of 'v Pos.marked |
| PrintAlias of 'v Pos.marked |
| PrintIndent of 'v m_expression |
| PrintExpr of 'v m_expression * int * int |
In the M language, you can define multiple variables at once. This is the way they do looping since the definition can depend on the loop variable value (e.g Xi
can depend on i
).
type 'v formula_loop = 'v loop_variables Pos.marked
type 'v formula_decl = 'v Pos.marked * 'v m_expression option * 'v m_expression
type 'v formula =
| SingleFormula of 'v formula_decl |
| MultipleFormulaes of 'v formula_loop * 'v formula_decl |
type ('v, 'e) instruction =
| Affectation of 'v formula Pos.marked |
| IfThenElse of 'v m_expression
* ( 'v, 'e ) m_instruction list
* ( 'v, 'e ) m_instruction list |
| WhenDoElse of ('v m_expression * ( 'v, 'e ) m_instruction list * Pos.t) list
* ( 'v, 'e ) m_instruction list Pos.marked |
| ComputeDomain of string Pos.marked list Pos.marked |
| ComputeChaining of string Pos.marked |
| ComputeVerifs of string Pos.marked list Pos.marked * 'v m_expression |
| ComputeTarget of string Pos.marked * 'v Pos.marked list |
| VerifBlock of ( 'v, 'e ) m_instruction list |
| Print of print_std * 'v print_arg Pos.marked list |
| Iterate of 'v Pos.marked
* 'v Pos.marked list
* (Pos.t CatVar.Map.t * 'v m_expression) list
* ( 'v, 'e ) m_instruction list |
| Restore of 'v Pos.marked list
* ('v Pos.marked * Pos.t CatVar.Map.t * 'v m_expression) list
* ( 'v, 'e ) m_instruction list |
| RaiseError of 'e Pos.marked * string Pos.marked option |
| CleanErrors |
| ExportErrors |
| FinalizeErrors |
and ('v, 'e) m_instruction = ( 'v, 'e ) instruction Pos.marked
val set_loc_tgv_cat : loc -> CatVar.loc -> string -> int -> loc
val format_loop_variables :
( Pp.t -> 'v -> unit ) ->
Pp.t ->
'v loop_variables ->
unit
val format_expression : ( Pp.t -> 'v -> unit ) -> Pp.t -> 'v expression -> unit
val format_instruction :
( Pp.t -> 'v -> unit ) ->
( Pp.t -> 'e -> unit ) ->
Pp.t ->
( 'v, 'e ) instruction ->
unit
val format_instructions :
( Pp.t -> 'v -> unit ) ->
( Pp.t -> 'e -> unit ) ->
Pp.t ->
( 'v, 'e ) m_instruction list ->
unit