Commit 2c7eb7d5 authored by Bruno Guillaume's avatar Bruno Guillaume

rename keyword confluent into deterministic

parent af8d2c30
......@@ -6,7 +6,7 @@
(require 'generic-x) ;;pour Emacs OK, mais semble ne pas marcher avec XEmacs
(define-generic-mode 'grew-mode
'("%");;comments
'("features" "module" "rule" "match" "without" "labels" "sequences" "commands" "graph" "confluent" "include" "filter");;keywords
'("features" "module" "rule" "match" "without" "labels" "sequences" "commands" "graph" "confluent" "deterministic" "include" "filter");;keywords
'(
;; ("class\\s (\*\*)* +\\(\\sw[a-zA-Z0-9_.-]*\\)" 1 'font-lock-type-face);noms de classes
;; ("\?[a-zA-Z0-9]+" . font-lock-variable-name-face)
......
......@@ -337,7 +337,7 @@ module Ast = struct
module_id:Id.name;
local_labels: (string * string list) list;
rules: rule list;
confluent: bool;
deterministic: bool;
module_doc:string list;
mod_loc:Loc.t;
mod_dir: string; (* the directory where the module is defined (for lp file localisation) *)
......
......@@ -174,7 +174,7 @@ module Ast : sig
module_id:Id.name;
local_labels: (string * string list) list;
rules: rule list;
confluent: bool;
deterministic: bool;
module_doc:string list;
mod_loc:Loc.t;
mod_dir: string; (* the directory where the module is defined (for lp file localisation) *)
......
......@@ -87,7 +87,7 @@ module Rewrite_history = struct
| l, _ -> List.iter loop l
in loop t; !cpt
(* suppose that all modules are confluent and produced exacly one normal form *)
(* suppose that all modules are deterministic and produced exacly one normal form *)
let save_det_gr ?domain base t =
let rec loop t =
match (t.good_nf, t.bad_nf) with
......@@ -155,14 +155,14 @@ module Modul = struct
local_labels: (string * string list) array;
rules: Rule.t list;
filters: Rule.t list;
confluent: bool;
deterministic: bool;
loc: Loc.t;
}
let to_json ?domain t =
`Assoc [
("module_name", `String t.name);
("confluent", `Bool t.confluent);
("deterministic", `Bool t.deterministic);
("rules", `List (List.map (Rule.to_json ?domain) t.rules));
]
......@@ -186,7 +186,7 @@ module Modul = struct
local_labels = locals;
rules;
filters;
confluent = ast_module.Ast.confluent;
deterministic = ast_module.Ast.deterministic;
loc = ast_module.Ast.mod_loc;
} in
check modul; modul
......@@ -290,7 +290,7 @@ module Grs = struct
Rule.normalize
?domain: grs.domain
next.Modul.name
~confluent: next.Modul.confluent
~deterministic: next.Modul.deterministic
next.Modul.rules
next.Modul.filters
(Instance.refresh instance) in
......@@ -319,7 +319,7 @@ module Grs = struct
let modul =
try List.find (fun m -> m.Modul.name=module_name) grs.modules
with Not_found -> Error.build "No module named '%s'" module_name in
if modul.Modul.confluent
if modul.Modul.deterministic
then Ast.Pick (Ast.Star (Ast.Ref module_name))
else Ast.Star (Ast.Ref module_name)
) module_list
......@@ -477,7 +477,7 @@ module Grs = struct
Rule.normalize
?domain: grs.domain
next.Modul.name
~confluent: next.Modul.confluent
~deterministic: next.Modul.deterministic
next.Modul.rules
next.Modul.filters
(Instance.refresh instance) in
......
......@@ -73,7 +73,7 @@ module Modul: sig
local_labels: (string * string list) array;
rules: Rule.t list;
filters: Rule.t list;
confluent: bool;
deterministic: bool;
loc: Loc.t;
}
......
......@@ -961,7 +961,7 @@ module Corpus_stat = struct
) t.modules;
(* add a subtable for sentence ambiguity *)
if (List.for_all (fun m -> m.Modul.confluent) t.modules) || (Int_map.is_empty t.amb)
if (List.for_all (fun m -> m.Modul.deterministic) t.modules) || (Int_map.is_empty t.amb)
then ()
else
begin
......
......@@ -172,7 +172,8 @@ and standard target = parse
| "del_feat" { DEL_FEAT }
| "module" { MODULE }
| "confluent" { CONFLUENT }
| "confluent" { Log.fwarning "[file %s, line %d]\"confluent\" is deprecated, please use \"deterministic\" instead" !Global.current_file !Global.current_line; DETERMINISTIC }
| "deterministic" { DETERMINISTIC }
| "rule" { RULE }
| "lex_rule" { Log.fwarning "[file %s, line %d]\"lex_rule\" is deprecated, please use \"rule\" instead" ! Global.current_file !Global.current_line; RULE }
| "filter" { FILTER }
......
......@@ -81,7 +81,7 @@ let localize t = (t,get_loc ())
%token WITHOUT /* without */
%token COMMANDS /* commands */
%token MODULE /* module */
%token CONFLUENT /* confluent */
%token DETERMINISTIC /* deterministic (of deprecated confluent) */
%token RULE /* rule */
%token FILTER /* filter */
%token SEQUENCES /* sequences */
......@@ -310,12 +310,12 @@ included:
| x=list(module_or_include) EOF { x }
grew_module:
| doc=option(COMMENT) MODULE conf=boption(CONFLUENT) id_loc=simple_id_with_loc LACC l=option(labels) r=rules RACC
| doc=option(COMMENT) MODULE det=boption(DETERMINISTIC) id_loc=simple_id_with_loc LACC l=option(labels) r=rules RACC
{
{ Ast.module_id = fst id_loc;
local_labels = (match l with None -> [] | Some x -> x);
rules = r;
confluent = conf;
deterministic = det;
module_doc = (match doc with Some d -> d | None -> []);
mod_loc = snd id_loc;
mod_dir = "";
......
......@@ -1283,8 +1283,8 @@ module Rule = struct
| None -> Instance.rev_steps instance
(* ---------------------------------------------------------------------- *)
let normalize ?domain modul_name ?(confluent=false) rules filters instance =
if confluent
let normalize ?domain modul_name ?(deterministic=false) rules filters instance =
if deterministic
then
let output = conf_normalize ?domain modul_name instance rules in
if filter_instance ?domain filters output
......
......@@ -87,12 +87,12 @@ module Rule : sig
[dir] is used for localisation of lp files *)
val build: ?domain:Domain.t -> ?locals:Label_domain.decl array -> string -> Ast.rule -> t
(** [normalize domain module_name ?confluent rule_list filter_list instance] returns two sets of good normal forms and bad normal forms *)
(** [normalize domain module_name ?deterministic rule_list filter_list instance] returns two sets of good normal forms and bad normal forms *)
(* raise Stop if some command fails to apply *)
val normalize:
?domain:Domain.t ->
string -> (* module name *)
?confluent:bool ->
?deterministic:bool ->
t list -> (* rule list *)
t list -> (* filter list *)
Instance.t ->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment