Commit 43521f9a authored by Bruno Guillaume's avatar Bruno Guillaume

function New_grs.simple_rewrite, second arg can be a strat description instead of a strat name

parent b812de8d
......@@ -872,9 +872,9 @@ module New_grs = struct
| Some _ -> det_strat_simple_rewrite pointed s2 instance
end
let simple_rewrite grs name graph =
let simple_rewrite grs strat graph =
let instance = Instance.from_graph graph in
let set = intern_simple_rewrite (top grs) name instance in
let set = strat_simple_rewrite (top grs) (Parser.strategy strat) instance in
List.map
(fun inst -> inst.Instance.graph)
(Instance_set.elements set)
......
......@@ -230,5 +230,14 @@ module Parser = struct
strategy
with Sys_error msg -> Error.parse "[Grew_loader.Parser.strategy] %s" msg
(* ------------------------------------------------------------------------------------------*)
let strategy desc =
try
Global.new_string ();
let lexbuf = Lexing.from_string desc in
let strategy = parse_handle (Grew_parser.strat_desc Grew_lexer.global) lexbuf in
strategy
with Sys_error msg -> Error.parse "[Grew_loader.Parser.strategy] %s" msg
end
......@@ -35,4 +35,6 @@ module Parser : sig
val pattern: string -> Ast.pattern
val strat_def: string -> Ast.strat_def
val strategy: string -> New_ast.strat
end
......@@ -129,8 +129,7 @@ let localize t = (t,get_loc ())
%start <Grew_ast.Ast.strat_def> strat_def
%start <Grew_ast.New_ast.grs> new_grs
%start <Grew_ast.New_ast.strat> strat_desc
/* parsing of the string representation of the constituent representation of Sequoia */
/* EX: "( (SENT (NP (NC Amélioration) (PP (P de) (NP (DET la) (NC sécurité))))))" */
......
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