Commit b3a0f65b authored by POGODALLA Sylvain's avatar POGODALLA Sylvain

Bug fix in management of lexical entries for constants

parent adffe33d
......@@ -84,6 +84,7 @@ signature logic =
binder All : (e=>t) -> t;
binder Ex : (e=>t) -> t;
end
lexicon semantics (syntax) : logic =
......@@ -102,6 +103,6 @@ lexicon semantics (syntax) : logic =
(* Note that we interpret LOVE whose first argument is the object and the second one as a suject using the predicate "love" for which love x y is true whenever x loves y *)
LOVE := lambda x y. love y x ;
EVERY := lambda P Q.All x. (P x) > (Q x);
EVERY := lambda P Q.All x. (P x) > (Q x);
SOME := lambda P Q.Ex x. (P x) & (Q x) ;
end
......@@ -22,7 +22,7 @@ signature abstract =
J,M,he,her,it:np;
man,woman,farmer,donkey:n;
loves,beats,owns : np => np => s;
a,every:n=>np;
a,every,most:n=>np;
who: (np => s) => n => n;
end
......@@ -42,6 +42,7 @@ signature object =
n = Lambda n .Lambda x.Lambda e phi.(n x) & (phi e) : (e => t) => e => o;
binder Ex : (e => t) => t ;
binder All : (e => t) => t ;
binder Most : (e => o) => o ;
prefix - : t => t ;
binder Ex_dyn = Lambda P . Lambda e phi.Ex x. P x (x+e) phi : (e => o) => o ;
prefix ~ = Lambda A . Lambda e phi. (-(A e (Lambda e.Top)))&(phi e) : o => o;
......@@ -67,5 +68,6 @@ lexicon montague (abstract) : object =
he,her,it := Lambda P.Lambda e phi. P (sel e) e phi;
a := Lambda P Q . Ex_dyn x. (P x) @ (Q x);
every := Lambda P Q . All_dyn x. (P x) > (Q x);
most := Lambda P Q . Most x. (P x) > (Q x);
who := Lambda R Q x. (Q x) @ (R (Lambda P.P x));
end
\ No newline at end of file
......@@ -20,7 +20,7 @@
load d ../data/montague-drt.acg;
list ;
abstract print;
abstract analyse beats (every farmer) a donkey) : s;
#abstract analyse beats (every farmer) a donkey) : s;
abstract analyse beats (every farmer) (a J) : s;
abstract analyse beats (every farmer) (a donkey) : s;
select object;
......
......@@ -47,12 +47,24 @@
exception No_sig
let cpt = ref 0
let incr () = cpt := (!cpt)+1
let cpt_to_string () = Printf.sprintf "%d" !cpt
type type_or_cst =
| Nothing
| Type
| Cst
| Both
let type_or_cst_to_string = function
| Nothing -> "Nothing"
| Type -> "Type"
| Cst -> "Cst"
| Both -> "Both"
exception Is_type
exception Is_cst
......@@ -415,6 +427,7 @@ sig_entries :
lex_entry :
| comma_ids_or_sym<ids> COLON_EQUAL ...{
let () = incr () in
let abs,obj = get_abs_and_obj_sig_value dyp.last_local_data in
let kind =
List.fold_left
......@@ -432,15 +445,18 @@ sig_entries :
kind}<kind>
term<t> {
try
let term = fst (t Env.empty []) in
(* let () = Printf.printf "(%s) Current id: %s\n%!" (cpt_to_string ()) (Utils.string_of_list " " (fun (x,_) -> x) ids ) in
let () = Printf.printf "(%s) Current kind: %s\n%!" (cpt_to_string()) (type_or_cst_to_string kind) in *)
fun lex ->
let term = fst (t Env.empty []) in
(* let () = Printf.printf "Ok for the term\n%!" in *)
List.fold_left
(fun acc (id,loc) -> E.Lexicon.insert (Abstract_syntax.Constant (id,loc,term)) acc)
lex
ids
with
| Error.Error (Error.Parse_error (Error.Unknown_constant _,_)) when kind = Both -> raise Dyp.Giveup
| exc -> raise exc}
| Error.Error (Error.Parse_error (Error.Unknown_constant _,_)) when kind = Both -> raise Dyp.Giveup
| exc -> raise exc }
| comma_ids<ids> COLON_EQUAL ...{
let abs,obj = get_abs_and_obj_sig_value dyp.last_local_data in
let kind =
......
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