Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intégration des domaines de règles dans le langage M #221

Merged
merged 27 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d279d92
Analyseur syntaxique pour l'extension de domaines de règles.
david-michel1 Jun 14, 2023
83b9fa0
Suite du précédent commit...
david-michel1 Jun 14, 2023
9f3ac5d
Remplacement partiel des tags par les domaines de règles (et les ench…
david-michel1 Jun 15, 2023
a2f8977
Avancée du remplacement des tags par les domaines.
Jun 20, 2023
248d4fa
Séparation des tags, des domaines de règles et des enchaîneurs.
david-michel1 Jun 21, 2023
b451fbe
Ajout de modules utiles (ensemble d'ensembles, etc.)
david-michel1 Jun 21, 2023
e49c859
Ajout de modules utiles (map d'ensembles, etc.)
david-michel1 Jun 23, 2023
511e531
Ajout de l'option without_dgfip_m.
david-michel1 Jun 23, 2023
a464a18
Ajout des domaines de vérifs.
david-michel1 Jun 28, 2023
af23cc7
Merge branch 'master' into extension_m_metier
david-michel1 Jun 28, 2023
e23fb38
Élimination du type chain_tag.
david-michel1 Jul 4, 2023
8969609
Correction d'une erreur bête.
david-michel1 Jul 4, 2023
d2087eb
Modification du M++ pour tenir compte des domaines.
david-michel1 Jul 6, 2023
e4c19b9
Correction des fichiers .mpp.
david-michel1 Jul 6, 2023
c1afc0c
Lecture des catégories de variables autorisées dans les domaines de v…
david-michel1 Jul 11, 2023
5848fd3
Réécriture des filtres de vérifs avec des domaines.
david-michel1 Jul 18, 2023
42b093e
Gestion des positions dans le M DGFiP interne.
david-michel1 Jul 20, 2023
0f7f581
Suppression des variables "dummy" dans les vérifs.
david-michel1 Jul 20, 2023
7d0d217
Modifications du MPP pour le filtrage des vérifs (en cours).
Jul 24, 2023
280a380
Modification du MPP pour le filtrage des vérifs.
david-michel1 Jul 25, 2023
438b7df
nsformation de "non_auto_cc" en un domaine de vérif par défaut.
Jul 26, 2023
5aaf051
Petit nettoyage
david-michel1 Jul 27, 2023
e42b8b8
Indentation
david-michel1 Jul 27, 2023
e2089e3
Factorisation et nettoyage du code.
david-michel1 Aug 4, 2023
35a7267
Supression du doublon "category" - "cats".
david-michel1 Aug 8, 2023
64a12b9
Suppression des constructions métiers ad hoc du MPP.
david-michel1 Aug 10, 2023
86273f1
Correction dans l'analyse du MPP.
david-michel1 Aug 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/mlang/backend_compilers/bir_to_dgfip_c.ml
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,6 @@ let generate_mpp_functions_signatures (oc : Format.formatter)

let generate_rovs_files (dgfip_flags : Dgfip_options.flags) (program : program)
(folder : string) (vm : Dgfip_varid.var_id_map) =
let module StringMap = Map.Make (String) in
let default_file = "default" in
let filemap =
ROVMap.fold
Expand All @@ -438,14 +437,12 @@ let generate_rovs_files (dgfip_flags : Dgfip_options.flags) (program : program)
^ ".c"
in
let filerovs =
match StringMap.find_opt file filemap with
| None -> []
| Some fr -> fr
match StrMap.find_opt file filemap with None -> [] | Some fr -> fr
in
StringMap.add file (rov :: filerovs) filemap)
program.rules_and_verifs StringMap.empty
StrMap.add file (rov :: filerovs) filemap)
program.rules_and_verifs StrMap.empty
in
StringMap.fold
StrMap.fold
(fun file rovs orphan ->
if String.equal file default_file then rovs @ orphan
else
Expand Down
24 changes: 9 additions & 15 deletions src/mlang/backend_compilers/dgfip_gen_files.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
You should have received a copy of the GNU General Public License along with
this program. If not, see <https://www.gnu.org/licenses/>. *)

module StringSet = Set.Make (String)
module StringMap = Map.Make (String)

let ascii_to_ebcdic =
[|
0; 1; 2; 3; 55; 45; 46; 47; 22; 5; 37; 11; 12; 13; 14; 15;
Expand Down Expand Up @@ -863,7 +860,7 @@ let get_rules_verif_etc prog =
( Pos.unmark r.rule_number :: rules,
match r.rule_chaining with
| None -> chainings
| Some cn -> StringSet.add (Pos.unmark cn) chainings )
| Some cn -> StrSet.add (Pos.unmark cn) chainings )
else (rules, chainings)
in
(rules, verifs, errors, chainings)
Expand All @@ -884,8 +881,7 @@ let get_rules_verif_etc prog =
| _ -> (rules, verifs, errors, chainings))
(rules, verifs, errors, chainings)
file)
([], [], [], StringSet.empty)
prog
([], [], [], StrSet.empty) prog
in

let rules = List.fast_sort compare rules in
Expand Down Expand Up @@ -920,12 +916,10 @@ let gen_table_call fmt flags vars_debug rules chainings errors =
Format.fprintf fmt "};\n\n"
end;

StringSet.iter
(fun cn -> Format.fprintf fmt "extern void %s();\n" cn)
chainings;
StrSet.iter (fun cn -> Format.fprintf fmt "extern void %s();\n" cn) chainings;

Format.fprintf fmt "T_desc_ench desc_ench[NB_ENCH + 1] = {\n";
StringSet.iter
StrSet.iter
(fun cn -> Format.fprintf fmt " { \"%s\", %s },\n" cn cn)
chainings;
Format.fprintf fmt "};\n"
Expand Down Expand Up @@ -982,7 +976,7 @@ let gen_var_h fmt flags vars vars_debug rules verifs chainings errors =
let nb_variation = count vars (Input (Some Variation)) in
let nb_penalite = count vars (Input (Some Penality)) in
let nb_restituee = count vars Output in
let nb_ench = StringSet.cardinal chainings in
let nb_ench = StrSet.cardinal chainings in
let nb_err = List.length errors in
let nb_debug = List.map List.length vars_debug in
let nb_call = List.length rules in
Expand Down Expand Up @@ -1165,11 +1159,11 @@ let extract_var_ids (cprog : Bir.program) vars =
let pvars = cprog.mir_program.program_vars in
let add vn v vm =
let vs =
match StringMap.find_opt vn vm with
match StrMap.find_opt vn vm with
| None -> VariableSet.empty
| Some vs -> vs
in
StringMap.add (Pos.unmark v.Variable.name) (VariableSet.add v vs) vm
StrMap.add (Pos.unmark v.Variable.name) (VariableSet.add v vs) vm
in
(* Build a map from variable names to all their definitions (with different
ids) *)
Expand All @@ -1178,7 +1172,7 @@ let extract_var_ids (cprog : Bir.program) vars =
(fun v vm ->
let vm = add (Pos.unmark v.Variable.name) v vm in
match v.Variable.alias with Some a -> add a v vm | None -> vm)
pvars StringMap.empty
pvars StrMap.empty
in
let process_var ~alias
( tvar,
Expand Down Expand Up @@ -1209,7 +1203,7 @@ let extract_var_ids (cprog : Bir.program) vars =
(fun vm vd ->
let name, vid = process_var ~alias:false vd in
let vs =
try StringMap.find name vars_map
try StrMap.find name vars_map
with Not_found ->
Errors.raise_error (Format.asprintf "Variable %s is undeclared" name)
in
Expand Down
8 changes: 4 additions & 4 deletions src/mlang/backend_ir/bir.ml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ let compare_variable v1 v2 =
let c = Stdlib.compare v1.offset v2.offset in
if c <> 0 then c else Mir.Variable.compare v1.mir_var v2.mir_var

module VariableMap = Map.Make (struct
module VariableMap = MapExt.Make (struct
type t = variable

let compare = compare_variable
end)

module VariableSet = Set.Make (struct
module VariableSet = SetExt.Make (struct
type t = variable

let compare = compare_variable
end)

module NameMap = Map.Make (String)
module NameMap = StrMap

type offset_alloc = { mutable name_map : int NameMap.t; mutable size : int }

Expand Down Expand Up @@ -115,7 +115,7 @@ let rule_or_verif_as_statements (rov : rule_or_verif) : stmt list =

type mpp_function = { mppf_stmts : stmt list; mppf_is_verif : bool }

module FunctionMap = Map.Make (struct
module FunctionMap = MapExt.Make (struct
type t = function_name

let compare = String.compare
Expand Down
6 changes: 3 additions & 3 deletions src/mlang/backend_ir/bir.mli
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ type tgv_id = string

type variable = { on_tgv : tgv_id; offset : int; mir_var : Mir.Variable.t }

module VariableMap : Map.S with type key = variable
module VariableMap : MapExt.T with type key = variable

module VariableSet : Set.S with type elt = variable
module VariableSet : SetExt.T with type elt = variable

type expression = variable Mir.expression_

Expand Down Expand Up @@ -53,7 +53,7 @@ and stmt_kind =

type mpp_function = { mppf_stmts : stmt list; mppf_is_verif : bool }

module FunctionMap : Map.S with type key = function_name
module FunctionMap : MapExt.T with type key = function_name

type program_context = {
constant_inputs_init_stmts : stmt list;
Expand Down
4 changes: 2 additions & 2 deletions src/mlang/backend_ir/bir_instrumentation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License along with
this program. If not, see <https://www.gnu.org/licenses/>. *)

module CodeLocationMap = Map.Make (struct
module CodeLocationMap = MapExt.Make (struct
type t = Bir_interpreter.code_location

let compare x y = compare x y
Expand Down Expand Up @@ -46,7 +46,7 @@ let code_coverage_init () : unit =

let code_coverage_result () : code_coverage_result = !code_coverage_acc

module VarLiteralSet = Set.Make (struct
module VarLiteralSet = SetExt.Make (struct
type t = Bir_interpreter.var_literal

let compare x y =
Expand Down
4 changes: 2 additions & 2 deletions src/mlang/backend_ir/bir_instrumentation.mli
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

(** {1 Code coverage for a single run}*)

module CodeLocationMap : Map.S with type key = Bir_interpreter.code_location
module CodeLocationMap : MapExt.T with type key = Bir_interpreter.code_location

type code_coverage_result =
Bir_interpreter.var_literal CodeLocationMap.t Bir.VariableMap.t
Expand All @@ -40,7 +40,7 @@ val code_coverage_result : unit -> code_coverage_result
(** Code coverage is best measured for multiple runs of the interpreter on a set
of test files. *)

module VarLiteralSet : Set.S with type elt = Bir_interpreter.var_literal
module VarLiteralSet : SetExt.T with type elt = Bir_interpreter.var_literal

type code_coverage_map_value = VarLiteralSet.t

Expand Down
Loading