Commit 0080986b authored by POGODALLA Sylvain's avatar POGODALLA Sylvain
Browse files

No commit message

No commit message
parent 491e0f86
......@@ -2,22 +2,34 @@ wait;
load d ../data/strings.acg;
load d ../data/cvg3.acg;
compose CVG_strings CVG_syntax as CVG_phonology;
compose RC_ty CVG_semantics as ty_sem;
# Scope ambiguity
CVG_phonology CVG_syntax CVG_semantics analyse G_q SO (lambda y. G_q EV (lambda x.LIKE y x)) :S ;
CVG_phonology CVG_syntax CVG_semantics ty_sem analyse G_q SO (lambda y. G_q EV (lambda x.LIKE y x)) :S ;
CVG_phonology CVG_syntax CVG_semantics ty_sem analyse G_q EV (lambda x. G_q SO (lambda y.LIKE y x)) :S ;
# Embedded polar question
CVG_phonology CVG_syntax CVG_semantics analyse WHETHER (LIKE SANDY KIM): Q0 ;
CVG_phonology CVG_syntax CVG_semantics ty_sem analyse WHETHER (LIKE SANDY KIM): Q0 ;
# Embedded consituent question
CVG_phonology CVG_syntax CVG_semantics analyse G_w1 WHAT_FILLER (lambda y. LIKE y KIM) :Q1 ;
CVG_phonology CVG_syntax CVG_semantics ty_sem analyse G_w1 WHAT_FILLER (lambda y. LIKE y KIM) :Q1 ;
# Embedded consituent question
CVG_phonology CVG_syntax CVG_semantics analyse G_w2 WHAT_IN_SITU_1 (lambda y.LIKE y KIM) : Q2 ;
CVG_phonology CVG_syntax CVG_semantics ty_sem analyse G_w2 WHAT_IN_SITU_1 (lambda y.LIKE y KIM) : Q2 ;
# Binary consituent question
CVG_phonology CVG_syntax CVG_semantics analyse G_w2 WHAT_IN_SITU_1 (lambda y. G_w1 WHO_FILLER (lambda x . LIKE y x)) :Q2 ;
CVG_phonology CVG_syntax CVG_semantics ty_sem analyse G_w2 WHAT_IN_SITU_1 (lambda y. G_w1 WHO_FILLER (lambda x . LIKE y x)) :Q2 ;
CVG_phonology CVG_syntax CVG_semantics analyse G_w2 WHO_IN_SITU_1 (lambda x. G_w1 WHAT_FILLER (lambda y . LIKE y x)) :Q2 ;
CVG_phonology CVG_syntax CVG_semantics ty_sem analyse G_w2 WHO_IN_SITU_1 (lambda x. G_w1 WHAT_FILLER (lambda y . LIKE y x)) :Q2 ;
# Baker ambiguity
CVG_phonology CVG_syntax CVG_semantics analyse G_w1 WHO_FILLER (lambda x. WONDER2 (G_w2 WHAT_IN_SITU_1 (lambda y. G_w1 WHO_FILLER (lambda z. LIKE y z))) x) : Q1;
\ No newline at end of file
CVG_phonology CVG_syntax CVG_semantics ty_sem analyse G_w1 WHO_FILLER (lambda x. WONDER2 (G_w2 WHAT_IN_SITU_1 (lambda y. G_w1 WHO_FILLER (lambda z. LIKE y z))) x) : Q1;
CVG_phonology CVG_syntax CVG_semantics ty_sem analyse G_w2 WHAT_IN_SITU_1 (lambda y. G_w1 WHO_FILLER (lambda x. WONDER1 (G_w1 WHO_FILLER (lambda z. LIKE y z)) x)) : Q2;
CVG_phonology CVG_syntax CVG_semantics ty_sem analyse G_w1 WHO_FILLER (lambda x. WONDER2 (G_w2 WHO_IN_SITU_1 (lambda z. G_w1 WHAT_FILLER (lambda y. LIKE y z))) x) : Q1;
# Topicalisation
CVG_phonology CVG_syntax CVG_semantics analyse G_t_in_situ (" SANDY) (lambda y . LIKE y KIM) : S;
CVG_phonology CVG_syntax CVG_semantics analyse G_t (^ SANDY) (lambda y . LIKE y KIM) : T;
......@@ -25,11 +25,18 @@ signature syntax =
WHO_IN_SITU_1,WHAT_IN_SITU_1 : NP_Q1_Q2;
WHO_IN_SITU_2,WHAT_IN_SITU_2 : NP_Q2_Q3;
T,NP_S_T,NP_S_T_in_situ:type;
G_t : NP_S_T -> (NP -> S) -> T;
G_t_in_situ : NP_S_T_in_situ -> (NP -> S) -> S;
prefix ^ : NP -> NP_S_T;
prefix " : NP -> NP_S_T_in_situ;
end
signature simple_syntax =
NP,S,Q:type;
NP,S,Q,T:type;
everybody,somebody:NP;
barked : NP -> S;
liked:NP -> NP -> S;
......@@ -42,6 +49,9 @@ signature simple_syntax =
who_in_situ,what_in_situ:NP;
who_filler,what_filler: (NP -> S) -> Q;
prefix ^ : NP -> (NP -> S) -> T ;
prefix " : NP -> NP ;
end
......@@ -88,12 +98,23 @@ lexicon CVG_syntax (syntax) : simple_syntax =
WHAT_IN_SITU_2 := what_in_situ ;
WHO_IN_SITU_2 := who_in_situ ;
T := T;
NP_S_T := (NP -> S) -> T;
NP_S_T_in_situ := NP;
G_t := lambda t r . t r;
G_t_in_situ := lambda n r.r n;
^ := lambda n . ^ n ;
" := lambda n . " n ;
end
lexicon CVG_strings (simple_syntax) : strings =
NP,S,Q:= string;
NP,S,Q,T:= string;
everybody := everyone;
somebody := someone;
......@@ -111,6 +132,11 @@ lexicon CVG_strings (simple_syntax) : strings =
who_filler := lambda P . who + (P E);
what_in_situ := what;
what_filler := lambda P. what + (P E);
^ := lambda s r. s ! (r E) ;
" := lambda n . " n ;
end
......@@ -119,11 +145,6 @@ signature semantics =
k,k1,k2,k3:type;
(* G_w1 : (e ->t) -> k1;
G_w2 : (e -> k1) -> k2;
G_w3 : (e -> k2) -> k3;
*)
everybody',somebody': (e -> t) -> t;
chris',kim',dana',sandy':e;
......@@ -141,6 +162,11 @@ signature semantics =
who_filler,what_filler : (e -> t) -> k1;
who_in_situ12,what_in_situ12 : (e -> k1) -> k2 ;
who_in_situ23,what_in_situ23 : (e -> k2) -> k3;
top' : e -> (e ->t) -> t
end
......@@ -190,6 +216,15 @@ lexicon CVG_semantics (syntax) : semantics =
WHO_IN_SITU_2 := who_in_situ23 ;
WHAT_IN_SITU_2 := what_in_situ23 ;
T := t;
NP_S_T := (e -> t) -> t;
NP_S_T_in_situ := (e ->t) -> t;
G_t := lambda t r . t r;
G_t_in_situ := lambda t r.t r;
^ := lambda n. top' n;
" := lambda n. top' n;
end
......@@ -198,15 +233,28 @@ signature ty_n =
e,t:type;
everybody',somebody': (e -> t) -> t ;
(* everybody',somebody': (e -> t) -> t ;*)
chris',kim',dana',sandy':e;
person',thing' : e -> t;
whether' : t -> t -> t;
binder All : (e =>t) -> t;
binder Ex : (e =>t) -> t;
infix & : t -> t -> t;
infix | : t -> t -> t;
infix > : t -> t -> t;
everybody' = lambda P.All x. (person' x) > (P x): (e->t) -> t;
somebody' = lambda P. Ex x. (person' x) & (P x): (e->t) -> t;
whether' : t -> t -> t;
which0 : (e ->t) -> (e -> t) -> e -> t -> t ;
which1 : (e ->t) -> (e -> e -> t -> t) -> e -> e -> t -> t ;
which2 : (e ->t) -> (e -> e -> e -> t -> t) -> e -> e -> e -> t -> t ;
......@@ -222,14 +270,16 @@ signature ty_n =
barke' : e -> t;
think' : t -> e -> t;
k = t -> t:type;
(* k = t -> t:type;
k1 = e -> t -> t:type;
k2 = e -> e -> t -> t:type;
k3 = e -> e -> e -> t -> t:type;
k3 = e -> e -> e -> t -> t:type; *)
wonder1' : k1 -> e -> t;
wonder2' : k2 -> e -> t;
wonder3' : k3 -> e -> t;
wonder1' : (e -> t -> t) -> e -> t;
wonder2' : (e -> e -> t -> t) -> e -> t;
wonder3' : (e -> e -> e -> t -> t) -> e -> t;
top' : e -> (e ->t) -> t
end
......@@ -267,5 +317,7 @@ lexicon RC_ty (semantics) : ty_n =
what_in_situ12 := what12;
what_in_situ23 := what23 ;
top':=top';
end
\ No newline at end of file
open Environment
type action =
| Load
| List
| Select
| Unselect
| Trace
| Print
| Analyse
| Compose
| Dont_wait
| Wait
| Help of action option
let rec action_to_sting = function
| Load -> "load"
| List -> "list"
| Select -> "select"
| Unselect -> "unselect"
| Trace -> "trace"
| Print -> "print"
| Analyse -> "analyse"
| Compose -> "compose"
| Dont_wait -> "don't wait"
| Wait -> "wait"
| Help None -> "help"
| Help (Some a) -> Printf.sprintf "%s help" (action_to_string a)
let help_messages = [
Load,Printf.sprintf "%s d|s file: loads the file \"file\" as data (d option) or as a script (s option)" (action_to_string Load);
List,Printf.sprintf "%s d|s file: lists the signatures and the lexicons of the current environmnet" (action_to_string List);
Select,Printf.sprintf "%s name: selects the name signature or lexicon in the current environment and make it an implicit context for following commands" (action_to_string Select);
Unselect,Printf.sprintf "%s name: remove any selected signature or lexicon from the context" (action_to_string Unselect);
Trace,Printf.sprintf "%s: traces the interpretation (if a command is used in a context of a lexicon) and the beta-reduction process" (action_to_string Trace);
Untrace,Printf.sprintf "%s: stops tracing" (action_to_string Untrace);
module Make (E:Environment_sig) =
struct
......
......@@ -63,8 +63,8 @@ WAIT
command:
| WAIT SEMICOLONN[l] {fun e -> let () = echo l in let () = F.wait () in e}
| DONT WAIT SEMICOLONN[l] {fun e -> let () = echo l in let () = F.dont_wait () in e}
| WAIT SEMICOLONN[l] @{(fun e -> let () = echo l in let () = F.wait () in e),[Global_data true]}
| DONT WAIT SEMICOLONN[l] @{(fun e -> let () = echo l in let () = F.dont_wait () in e),[Global_data false]}
| LOAD_DATA[(s,loc,l)] {fun e -> let () = echo l in F.load F.Data s e}
| LOAD_SCRIPT[(s,loc,l)] {fun e -> let () = echo l in F.load (F.Script (snd dyp.last_local_data)) s e}
| LIST SEMICOLONN[l] {fun e -> let () = echo l in let () = F.list e in e}
......
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