Commit e29abb57 authored by POGODALLA Sylvain's avatar POGODALLA Sylvain

Added the possibility to remove the arity number added to non-terminal symbols in TAG-like grammars

parent 3ec05257
......@@ -2,7 +2,8 @@ The ACG software is developped by the CALLIGRAMME team of the LORIA
Main authors of the Leopar software code are:
- Philippe de Groote
- Sarah Maarek
- Philippe de Groote
- Jiří Maršík
- Sylvain Pogodalla
- Sylvain Salvati
......@@ -27,7 +27,8 @@
** Optimisation
+ [ ] magic rewriting
+ [ ] PersistentArray
+ [ ] paralélisme
+ [ ] parallélisme
+ [ ] Mettre un compteur des règles utilisés qui tienne compte du nombre de terminaux générés pour profiter de la linéarité et éviter d'essayer des règles qui rajouteraient des terminaux au-delà du nombre d'occurrences dans le terme à parser
** Permettre l'utilisation des PersistentArray
......
......@@ -169,7 +169,7 @@ let string = (letter|digit|'_')*'\''*
Token.IDENT (id,loc lexbuf)}
| symbol {let () = update_data Entry.Sym (loc lexbuf) in
Token.SYMBOL (Lexing.lexeme lexbuf,loc lexbuf)}
| _ as c {raise (Error.Error (Error.Lexer_error (Error.Bad_token,loc lexbuf)))}
| _ {raise (Error.Error (Error.Lexer_error (Error.Bad_token,loc lexbuf)))}
and comment depth = parse
| "*)" {match depth with
| [a] -> lexer lexbuf
......
......@@ -529,19 +529,9 @@ sig_entries :
| (Nothing|Both),true,false -> raise Dyp.Giveup
| (Nothing|Both),false,false -> emit_parse_error (Error.Unknown_type id) loc
| Type,_,false -> emit_parse_error (Error.Unknown_type id) loc
| Cst,_,_ -> failwith "Bug: should not occur"
(* match k,E.Signature1.is_type id abs with
| (None|Some Type),true -> Some Type
| None,false ->
if fst (E.Signature1.is_constant id abs)
then
raise Dyp.Giveup
else
emit_parse_error (Error.Unknown_type id) loc
| Some Type,false -> emit_parse_error (Error.Unknown_type id) loc
| Some Cst,_ -> failwith "Bug: should not occur"*) )
Nothing
ids in ()}
| Cst,_,_ -> failwith "Bug: should not occur" )
Nothing
ids in ()}
type_expression<ty> {
fun lex ->
let _,obj = get_abs_and_obj_sig_value dyp.last_local_data in
......@@ -718,7 +708,7 @@ end}
(** [parse_data filename dirs e] adds the data (signatures or
lexicons) parsed from file [filename] to [e] and returns the
[Some e'] where ]e'] is the resulting environment if the parse
[Some e'] where [e'] is the resulting environment if the parse
is successful. It returns [None] otherwise. [filename] is
looked for in [dirs] directories. *)
val parse_data : ?override:bool -> ?output:bool -> string -> string list -> E.t -> E.t option
......
......@@ -175,8 +175,8 @@ sig
(** [get_binder_argument_functionnal_type s sg] returns [None] if
the constant [s] is not defined in [sg] as a binder (that is
something of type [ ('a ?> 'b) ?> 'c ]) and returns [Some abs]
where [abs] is {!Abstract_syntax.Abstract_syntax.Linear} or
{!Abstract_syntax.Abstract_syntax.Non_linear} otherwise and
where [abs] is {!Abstract_syntax.Abstract_syntax.abstraction.Linear} or
{!Abstract_syntax.Abstract_syntax.abstraction.Non_linear} otherwise and
[abs] desribes the implication [?>] in [('a ?> 'b)] *)
val get_binder_argument_functional_type : string -> t -> Abstract_syntax.abstraction option
......
......@@ -115,10 +115,10 @@ module Lambda =
let rec unfold_binder binder l_level level id_to_sym acc (l_env, env) = function
| App (Const i,(LAbs(x,u) as t)) when (is_binder i id_to_sym)&&(i=binder) ->
| App (Const i,LAbs(x,u)) when (is_binder i id_to_sym)&&(i=binder) ->
let x' = generate_var_name x (l_env, env) in
unfold_binder binder (l_level+1) level id_to_sym ((l_level,(x',Abstract_syntax.Linear))::acc) ((l_level,x')::l_env,env) u
| App (Const i,(Abs(x,u) as t)) when (is_binder i id_to_sym)&&(i=binder) ->
| App (Const i,Abs(x,u)) when (is_binder i id_to_sym)&&(i=binder) ->
let x' = generate_var_name x (l_env, env) in
unfold_binder binder l_level (level+1) id_to_sym ((level,(x',Abstract_syntax.Non_linear))::acc) (l_env,(level,x')::env) u
| t -> acc,l_level,level,t
......
......@@ -245,10 +245,10 @@ struct
| (rep_i_index,Link_to _),(rep_j_index,(Value _ as v_j)) ->
{h'' with parents=Store.set rep_i_index v_j h''.parents}
| (rep_i_index,(Constr _ as v_i)),(rep_j_index,Link_to _) ->
| (rep_i_index,Constr _ ),(rep_j_index,Link_to _) ->
{h'' with parents=Store.set rep_j_index (Link_to rep_i_index) h''.parents}
| (rep_i_index,Link_to _),(rep_j_index,(Constr _ as v_j)) ->
| (rep_i_index,Link_to _),(rep_j_index,Constr _) ->
{h'' with parents=Store.set rep_i_index (Link_to rep_j_index) h''.parents}
| (rep_i_index,Constr (c_i,args_i)),(rep_j_index,Constr (c_j,args_j)) when c_i=c_j ->
......
......@@ -42,14 +42,24 @@ module Make (T : Show_text_sig) : Show_embellish_sig = struct
let logic_const name =
let name = match name with
| "Ex" -> "∃"
| "ExUni" -> "∃!"
| "Ex_l" -> "∃ₗ"
| "Ex_t" -> "∃ₜ"
| "All" -> "∀"
| "All_t" -> "∀ₜ"
| "TOP" -> "⊤"
| "The" -> "ι"
| "&" -> "∧"
| ">" -> "⇒"
| "~" -> "¬"
| _ -> name in
match name with
| "∃!"
| "∃ₗ"
| "∃ₜ"
| "∃"
| "∀"
| "∀ₜ"
| "ι" -> n name
|> reframe (fun exts ->
{ exts with w = exts.w -. (extents (n " ")).w })
......@@ -57,6 +67,17 @@ module Make (T : Show_text_sig) : Show_embellish_sig = struct
| "⇒" -> n name
| _ -> b name
let symbol_with_arity s =
let regexp = Str.regexp "^\\([A-Za-z]+\\)[0-9]+$" in
if Str.string_match regexp s 0 then
let s' = Str.matched_string s in
Str.matched_group 1 s'
else
s
let tag_derived_tree_cst s = symbol_with_arity s
let string_const = function
| "e" -> n "ε"
| name -> i name
......@@ -112,13 +133,21 @@ module Make (T : Show_text_sig) : Show_embellish_sig = struct
| "strings"
| "anglais"
| "francais" -> simplify_cats >> render_constants_with string_const
| "labelled_logic"
| "logic"
| "logique"
| "HybridLogic"
| "semantics" -> render_constants_with logic_const
| "Trees"
| "Derived_trees"
| "trees"
| "derived_trees" -> fun x y z t u v w -> tag_style x y z t u v (fun x -> let b,s = w x in b, tag_derived_tree_cst s)
| "discourse_grammar"
| "Derivations"
| "Derivation_trees"
| "derivation_trees"
| "Derived_trees"
| "derived_trees" -> tag_style
| "TAG"
| "DSTAG" -> fun x y z t u v w -> tag_style x y z t u v (fun x -> let b,s = w x in b, s)
| _ -> fun x -> x
end
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