Commit 3179f518 authored by POGODALLA Sylvain's avatar POGODALLA Sylvain

Initial import

parents
./configure && make
PHONY: config test
test:
$(MAKE) -C src $@
superclean clean:
if test "$@" = clean ; then $(MAKE) -C config $@ ; fi
$(MAKE) -C src $@
rm -rf *.log *~ autom4te.cache
find data/. -name "*~" -exec rm -f {} \;
# Part for the auto configuration
config: configure
configure: config/configure.ac
cd $(<D) && autoconf && mv configure .. & cd ..
PHONY: config test
test:
$(MAKE) -C src $@
superclean clean:
if test "$@" = clean ; then $(MAKE) -C config $@ ; fi
$(MAKE) -C src $@
rm -rf *.log *~ autom4te.cache
find data/. -name "*~" -exec rm -f {} \;
# Part for the auto configuration
config: configure
configure: config/configure.ac
cd $(<D) && autoconf && mv configure .. & cd ..
This diff is collapsed.
clean:
rm -rf *.log config.* autom4te.cache *~
\ No newline at end of file
clean:
rm -rf *.log config.* autom4te.cache *~
\ No newline at end of file
AC_INIT([ACG DTK],[0.1],[sylvain.pogodalla@loria.fr])
#AC_COPYRIGHT([Cecill])
OCAML_REQUIRED=3.07
# First look for bytecode compilers (ocamlc.opt or ocamlc) in the path
# Fail if not present
AC_CHECK_PROGS(OCAMLC,ocamlc.opt ocamlc,no)
if test "$OCAMLC" = no ; then
AC_MSG_ERROR(Cannot find ocamlc.)
fi
# Then look at native code compilers (ocamlopt.opt or ocamlopt) in the path
# Fail if not present
# we first look for ocaml in the path; if not present, we fail
AC_CHECK_PROGS(OCAMLCOPT,ocamlopt.opt ocamlopt,no)
if test "$OCAMLCOPT" = no ; then
AC_MSG_ERROR(Cannot find ocamlc.opt.)
fi
# Look for the interpreter
AC_CHECK_PROG(OCAML,ocaml,ocaml,no)
if test "$OCAML" = no ; then
AC_MSG_ERROR(Cannot find ocaml.)
fi
# Look for camlp4o
AC_CHECK_PROG(OCAMLP4,camlp4o,camlp4o,no)
if test "$OCAMLP4" = no ; then
AC_MSG_ERROR(Cannot find camlp4o.)
fi
# Look for documentation generators (ocamldoc.opt or ocamldoc)
AC_CHECK_PROGS(OCAMLDOC,ocamldoc.opt ocamldoc,no)
if test "$OCAMLDOC" = no ; then
AC_MSG_ERROR(Cannot find ocamldoc.)
fi
# Look for dependency generator (ocamldep.opt or ocamldep)
AC_CHECK_PROGS(OCAMLDEP,ocamldep.opt ocamldep,no)
if test "$OCAMLDEP" = no ; then
AC_MSG_ERROR(Cannot find ocamldep.)
fi
# Look for camllex and camlyacc
AC_CHECK_PROGS(OCAMLLEX,ocamllex.opt ocamllex,no)
if test "$OCAMLLEX" = no ; then
AC_MSG_ERROR(Cannot find ocamllex)
fi
AC_CHECK_PROG(OCAMLYACC,ocamlyacc,ocamlyacc,no)
if test "$OCAMLYACC" = no ; then
AC_MSG_ERROR(Cannot find ocamlyacc)
fi
# What is the OCAML version ?
# we extract Ocaml version number
OCAML_VERSION=`$OCAMLC -version`
AC_MSG_CHECKING([for $OCAMLC version])
AC_MSG_RESULT([$OCAMLC version is $OCAML_VERSION])
# Check whether the caml version checker is provided
ML_CHECK_FILE=config/ml_check.ml
AC_CHECK_FILE($ML_CHECK_FILE,,AC_MSG_ERROR(Cannot check versions))
# check that this version is at least the one we need
if ($OCAML $ML_CHECK_FILE -ref $OCAML_REQUIRED $OCAML_VERSION > /dev/null) ; then
AC_MSG_RESULT($OCAMLC version $OCAMLVERSION is ok)
else
AC_MSG_ERROR($OCAMLC version $OCAMLVERSION found ; version $OCAML_NEEDED or greater is needed)
fi
# check if the dtypes option is present
if ($OCAML $ML_CHECK_FILE -ref 3.07 $OCAML_VERSION> /dev/null) ; then
AC_MSG_RESULT(Compilation will be done with the -dtypes option)
TYPES=-dtypes
else
AC_MSG_RESULT(Compilation will NOT be done with the -dtypes option)
TYPES=
fi
# check if the -w yz option is present
# and set the _loc variable of campl4 to loc
if ($OCAML $ML_CHECK_FILE -ref 3.09 $OCAML_VERSION > /dev/null) ; then
OCAML09WARNINGS="-w yz"
OCAMLP4_LOC="-loc loc"
AC_MSG_RESULT($OCAMLP4 calls will be done with the $OCAMLP4_LOC option)
else
OCAML09WARNINGS=
fi
AC_MSG_RESULT(Compilation will be done with the $OCAML09WARNINGS option)
############################
# substitutions to perform
AC_SUBST(OCAMLC)
AC_SUBST(OCAMLCOPT)
AC_SUBST(OCAMLP4)
AC_SUBST(OCAMLDOC)
AC_SUBST(OCAMLDEP)
AC_SUBST(OCAMLLEX)
AC_SUBST(OCAMLYACC)
AC_SUBST(TYPES)
AC_SUBST(OCAML09WARNINGS)
AC_SUBST(OCAMLP4_LOC)
AC_SUBST(SET_MAKE)
AC_CONFIG_FILES([./Makefile config/Makefile src/Makefile.master src/Makefile.common src/Makefile src/utils/Makefile src/grammars/Makefile src/lambda/Makefile])
AC_PROG_MAKE_SET
AC_OUTPUT
let version v =
try
let p = String.index_from v 0 '.' in
let major = int_of_string (String.sub v 0 p) in
try
let p2 =
try String.index_from v (p+1) '.'
with
| Not_found -> String.length v in
let minor = int_of_string (String.sub v (p+1) (p2 - p - 1)) in
try
let len = String.length v in
let add = int_of_string (String.sub v (p2+1) (len - p2 - 1)) in
(major, minor, add)
with
| _ -> (major, minor, 0)
with
| _ -> (major, 0, 0)
with
| _ -> (0,0,0)
let () =
let ref_version = ref "" in
Arg.parse
[ "-ref",Arg.Set_string ref_version," version_number: Check the version passed as anonymous arguments against this version_number" ]
(fun s ->
let v =
try
let p = String.index s '+' in
String.sub s 0 p
with
| Not_found -> s in
let (major,minor,add) = version v in
let (major_r, minor_r, add_r) = version !ref_version in
if major > major_r or (major = major_r && (minor > minor_r or (minor = minor_r && add >= add_r)))
then
let () = Printf.printf "OK\n" in exit 0
else
let () = Printf.printf "NOT OK\n" in exit 1)
"Usage: ml_check -ref ref_version_number version_number"
This diff is collapsed.
signature Abstract =
Na,Ns,Sa,Ss,VPa,WHs : type;
C_every,C_some : Na;
C_dog,C_cat : Na -> Ns;
C_barks : VPa -> Ns -> Ss;
C_chases,
C_likes,
C_loves : Sa -> VPa -> Ns -> Ns -> Ss;
C_john,
C_mary,
C_paul : Ns ;
Ivp : VPa;
In : Na;
Is : Sa
end
\ No newline at end of file
lexicon Ambiguity (BiAbstract) : Abstract =
n := n;
np := np;
s := s;
D_loves := C_sleeps;
D_saw := C_saw;
D_seeks := lambda x P . P (lambda y. C_seeks x x);
D_find := C_find;
D_tries_to := C_tries_to ;
D_sleeps:= C_sleeps;
D_man := C_man;
D_woman := C_woman;
D_taxi := C_taxi;
D_john := C_john;
D_bill := C_bill;
D_and := C_and;
D_a := lambda x P.P (C_a x);
D_every := lambda x P.P (C_every x) ;
D_A := lambda P Q.Q (C_A P) ;
D_U := lambda P Q.Q (C_U P) ;
D_who := C_who ;
end
\ No newline at end of file
lexicon Ambiguity (BiAbstract) : Abstract =
n := n;
np := np;
s := s;
D_loves := C_loves;
D_saw := C_saw;
D_seeks := lambda x P . P (lambda y. C_seeks x y);
D_find := C_find;
D_tries_to := C_tries_to ;
D_sleeps:= C_sleeps;
D_man := C_man;
D_woman := C_woman;
D_taxi := C_taxi;
D_john := C_john;
D_bill := C_bill;
D_and := C_and;
D_a := lambda x P.P (C_a x);
D_every := lambda x P.P (C_every x) ;
D_A := lambda P Q.Q (C_A P) ;
D_U := lambda P Q.Q (C_U P) ;
D_who := C_who ;
end
\ No newline at end of file
signature BiAbstract =
n,np,s : type;
D_loves, D_saw, D_find : np -> np -> s;
D_seeks : np -> ((np -> s ) -> s) -> s ;
D_tries_to : np -> (np -> s) -> s;
D_sleeps : np -> s ;
D_a, D_every : n -> (np ->s) -> s;
D_A, D_U : (np -> s) -> ((np -> s) -> (np -> s)) -> (np -> s) ;
D_man, D_woman, D_taxi : n ;
D_john, D_bill : np ;
D_and : (np -> s) -> np -> np -> s ;
D_who : (np -> s) -> n -> n
end
signature Initial_trees =
tree : type ;
N2,S2,VP2 : tree -> tree -> tree ;
N1,WH1,VP1 : tree -> tree ;
every,dog,cat,chases,some,
who,liked,said,does,think,
claims,seems,to_love,barks,
usually,alledgedly,
John,Mary,Paul,loves,likes : tree
end
\ No newline at end of file
signature Abstract =
n,np,s : type;
C_loves, C_saw, C_seeks, C_find : np -> np -> s;
C_tries_to : np -> (np ->s) -> s;
C_sleeps : np -> s;
C_a, C_every : n -> np ;
C_man, C_woman, C_taxi : n ;
C_john, C_bill : np ;
C_and : (np -> s) -> np -> np -> s ;
C_A, C_U : (np -> s) -> (np -> s) ;
C_who : (np -> s) -> n -> n
end
\ No newline at end of file
lexicon Sem_lex(BiAbstract) : Semantics =
n := e -> t ;
np := (e -> t) -> t ;
s := t ;
D_loves := lambda s o.s(lambda x.o(lambda y. LOVE x y)) ;
D_saw := lambda s o.s(lambda x.o(lambda y. SAW x y)) ;
D_find := lambda s o.s(lambda x.o(lambda y. FIND x y)) ;
D_sleeps := lambda s.s(lambda x. SLEEPS x) ;
D_tries_to := lambda s P. s (lambda x. TRY x (lambda y. P(lambda Q.Q y))) ;
D_seeks := lambda s o .s(lambda x. TRY x (lambda y.o(lambda u .u (lambda z. FIND y z)))) ;
D_a := lambda P Q.Exists x. (P x)&(Q (lambda P.P x)) ;
D_every := lambda P Q . All x. (P x) => (Q (lambda P. P x)) ;
D_man := MAN ;
D_woman := WOMAN ;
D_taxi := TAXI ;
D_john := lambda P. P JOHN ;
D_bill := lambda P. P BILL ;
D_and := Lambda P x y . (P x) & (P y) ;
D_A := lambda P Q s . (lambda x.ALLEGEDLY (Q P x)) s ;
D_U := lambda P Q s . (lambda x.USUALLY (Q P x)) s ;
D_who := lambda P Q. Lambda x. (P (lambda R.R x)) & (Q x)
end
\ No newline at end of file
signature Semantic_recipes =
e,h,l,t,p : type;
T = h => l => t ;
infix > : h => l => t ;
infix :: : l => p -> t ;
infix & : t -> t -> t ;
binder Ex_l : (l=>t)->t ;
binder Ex_h : (h =>t) -> t ;
binder Ex_e : (e=>t)->t ;
And,Imp : l => h => p ;
All,Some : e => l => p ;
dog,cat : e => p ;
barks : e => p ;
chases,likes,
loves,liked : e => e => p ;
U,A,seems : h => p ;
claims,said,
does_think,
who : e => h => p ;
john,mary,paul : e
end
\ No newline at end of file
signature Semantics =
e,t : type;
infix & : t -> t -> t ;
infix => : t -> t -> t ;
infix == : e -> e -> t ;
binder All : (e => t) -> t ;
binder Exists : (e => t) -> t ;
LOVE : e -> e -> t ;
SAW : e -> e -> t ;
(* SEEKS : e -> e -> t ; *)
FIND : e -> e -> t ;
TRY : e -> (e -> t) -> t;
SLEEPS : e -> t ;
MAN : e -> t ;
WOMAN : e -> t ;
TAXI : e -> t;
JOHN : e ;
BILL : e ;
ALLEGEDLY : t -> t ;
USUALLY : t -> t
end
\ No newline at end of file
lexicon Synt_lex (Abstract) : Syntax =
n := string ;
np := string ;
s := string ;
C_loves := lambda x y. x + [loves] + y ;
C_saw := lambda x y. x + [saw] + y ;
C_seeks := lambda x y. x + [seeks] + y ;
C_tries_to := lambda x R . x + [tries_to] + (R empty) ;
C_find := lambda x y. x + [find] + y ;
C_sleeps := lambda x. x + [sleeps] ;
C_a := lambda x. [a] + x ;
C_every := lambda x. [every] + x ;
C_man := [man] ;
C_woman := [woman] ;
C_taxi := [taxi] ;
C_john := [john] ;
C_bill := [bill] ;
C_and := lambda r x y. x + (r empty) + [andsodid] + y ;
C_A := lambda R x.x + [alledgedly] + (R empty) ;
C_U := lambda R x.x + [usually] + (R empty) ;
C_who := lambda R n . n + [who] + (R empty)
end
\ No newline at end of file
signature Syntax =
atom,s : type ;
string = s -> s ;
outfix [ ] : atom -> string;
infix + = lambda x y z. x (y z) : string -> string -> string;
empty = lambda x. x : string;
loves, saw, a, every, man, woman, taxi,
john, bill, andsodid, alledgedly, usually, sleeps, seeks,
who, tries_to, find :atom
end
lexicon Synt_lex (Abstract) : Initial_trees =
Ns := tree;
Ss := tree ;
Na := tree -> tree ;
Sa := tree -> tree ;
VPa := tree -> tree ;
Ivp :=lambda x.x;
In :=lambda x.x;
Is :=lambda x.x;
every := lambda x.N2 every x ;
some := lambda x.N2 some x ;
dog := lambda N. N (N1 dog) ;
cat := lambda N. N (N1 cat) ;
chases := lambda S V .lambda x y.S(S2 x (V(VP2 chases y))) ;
loves := lambda S V .lambda x y.S(S2 x (V(VP2 loves y))) ;
to_love := lambda S V .lambda x y.S2 y (S(S2 x (V(VP1 to_love))));
usually := lambda V .lambda x. V(VP2 usually x) ;
alledgedly := lambda V .lambda x. V(VP2 alledgedly x) ;
seems := lambda V .lambda x. V(VP2 seems x) ;
claims := lambda x S. lambda y. S (S2 x (VP2 claims y)) ;
said := lambda x S. lambda y. S (S2 x (VP2 said y)) ;
does_think := lambda x S. lambda y. S2 does (S (S2 x (VP2 think y))) ;
john :=N1 John;
mary :=N1 Mary;
paul :=N1 Paul;
who := WH1 who;
liked := lambda S V w x.S2 w (S(S2 x (V(VP1 liked))))
end
lexicon Sem_lex (Abstract) : Semantic_recipes =
Ns := (e => T) -> T ;
Ss := T;
Na := (e => T) -> (e => T) -> T;
Sa := (e => T) -> (e => T) ;
VPa := T -> T ;
Ivp :=lambda x.x;
In :=lambda x.x;
Is :=lambda x.x;
C_every := lambda r p. Lambda h l. Ex_h h1. Ex_l l1. Ex_l l2. Ex_l l3. Ex_e v1.
(h>l2) & (l2::(All v1 l3)) & (l3::(Imp l1 h1)) & (h1 > l) & (r v1 h l1) & (p v1 h l) ;
C_some := lambda r p. Lambda h l. Ex_h h1. Ex_l l1. Ex_l l2. Ex_l l3. Ex_e v1.
(h>l2) & (l2::(Some v1 l3)) & (l3::(And l1 h1)) & (h1 > l) & (r v1 h l1) & (p v1 h l) ;
C_dog := lambda q.q(Lambda x h l. (h>l) & (l::(dog x))) ;
C_cat := lambda q.q(Lambda x h l. (h>l) & (l::(cat x))) ;
C_barks := lambda a s. s(Lambda x. a(Lambda h l. (h>l) & (l::(barks x )))) ;
C_chases := lambda b a s o. s(b(Lambda x. a(o(Lambda y h l. (h>l) & (l::(chases x y)))))) ;
C_likes := lambda b a s o. s(b(Lambda x. a(o(Lambda y h l. (h>l) & (l::(likes x y)))))) ;
C_loves := lambda b a s o. s(b(Lambda x. a(o(Lambda y h l. (h>l) & (l::(loves x y)))))) ;
C_to_love := lambda b a o s. s(b(Lambda x. a(o(Lambda y h l. (h>l) & (l::(loves x y)))))) ;
C_usually := lambda a. lambda r. Lambda h l. Ex_h h1. Ex_l l1.
(r h l) & (h > l1) & (l1::(U h1)) & (h1 > l) & (a (Lambda h l.h>l) h l1 ) ;
C_alledgedly := lambda a. lambda r. Lambda h l. Ex_h h2. Ex_l l2.
(r h l) & (h > l2) & (l2::(A h2)) & (h2 > l) & (a (Lambda h l.h>l) h l2 ) ;
C_seems := lambda a. lambda r. Lambda h l. Ex_h h3. Ex_l l3.
(r h l) & (h > l3) & (l3::(seems h3)) & (h3 > l) & (a (Lambda h l.h>l) h l ) ;
C_claims := lambda s p r. Lambda y. p(s(Lambda x h l. Ex_l l1. Ex_h h1.
(h>l1) & (l1 :: (claims x h1)) & (r y h1 l))) ;
C_said := lambda s b r. b(Lambda y. s(Lambda x h l. Ex_h h1. Ex_l l1.
(h>l1) & (l1::(said x h1)) & (h1 > l) & (r y h1 l))) ;
C_does_think := lambda s b r.b(Lambda y. s(Lambda x h l. Ex_h h2. Ex_l l2.
(h>l2) & (l2::(does_think x h2)) & (h2 > l) & (r y h2 l))) ;
C_john := lambda P. P john ;
C_mary := lambda P. P mary ;
C_paul := lambda P. P paul ;
C_who := lambda p. Lambda h l. Ex_e v1. Ex_h h3. Ex_l l3.
(h>l3) & (l3::(who v1 h3)) & (h3>l) & (p v1 h3 l) ;
C_liked := lambda b a o s. o(b(Lambda y. a(s(Lambda x h l. (h>l) & (l::(liked x y))))))
end
signature Abstract =
case, gender, person, tense : type ;
sub, obj : case ;
f, m : gender ;
p1, p2, p3 : person ;
minus, plus : tense ;
S : (tense) type ;
N : (gender) type ;
VP : (gender, person) type ;
NP : (gender, person, case) type ;
john : (c:case) NP m p3 c ;
mary : (c:case) NP f p3 c ;
i : (g:gender) NP g p1 sub ;
me : (g:gender) NP g p1 obj ;
you : (g:gender, c:case) NP g p2 c ;
myself : (g:gender, t:tense)
(NP g p1 obj -> NP g p1 sub -> S t) -> NP g p1 sub => S t ;
yourself : (g:gender, t:tense)
(NP g p2 obj -> NP g p2 sub -> S t ) -> NP g p2 sub => S t ;
herself : (t:tense)
(NP f p3 obj -> NP f p3 sub -> S t ) -> NP f p3 sub => S t ;
himself : (t:tense)
(NP m p3 obj -> NP m p3 sub -> S t ) -> NP m p3 sub => S t ;
cook : (g:gender) N g ;
man : N m ;
woman : N f ;
good : (g:gender) N g -> N g ;
a : (g:gender, c:case, t:tense) N g -> (NP g p3 c -> S t ) -> S t ;
every : (g:gender, c:case, t:tense) N g -> (NP g p3 c -> S t ) -> S t ;
be_0 : (g:gender, p_o:person, p_s:person)
NP g p_o obj -> NP g p_s sub -> S minus ;
be_1 : (g:gender, p_o:person)
NP g p_o obj -> NP g p1 sub -> S plus ;
be_2 : (g:gender, p_o:person)
NP g p_o obj -> NP g p2 sub -> S plus ;
be_3 : (g:gender, p_o:person)
NP g p_o obj -> NP g p3 sub -> S plus ;
find_0 : (g_o:gender, p_o:person, g_s:gender, p_s:person)
NP g_o p_o obj -> NP g_s p_s sub -> S minus ;
find_1 : (g_o:gender, p_o:person, g_s:gender)
NP g_o p_o obj -> NP g_s p1 sub -> S plus ;
find_2 : (g_o:gender, p_o:person, g_s:gender)
NP g_o p_o obj -> NP g_s p2 sub -> S plus ;
find_3 : (g_o:gender, p_o:person, g_s:gender)
NP g_o p_o obj -> NP g_s p3 sub -> S plus ;
love_0 : (g_o:gender, p_o:person, g_s:gender, p_s:person)
NP g_o p_o obj -> NP g_s p_s sub -> S minus ;
love_1 : (g_o:gender, p_o:person, g_s:gender)
NP g_o p_o obj -> NP g_s p1 sub -> S plus ;
love_2 : (g_o:gender, p_o:person, g_s:gender)
NP g_o p_o obj -> NP g_s p2 sub -> S plus ;
love_3 : (g_o:gender, p_o:person, g_s:gender)
NP g_o p_o obj -> NP g_s p3 sub -> S plus ;
try_1 : (g:gender) VP g p1 -> NP g p1 sub -> S plus ;
try_2 : (g:gender) VP g p2 -> NP g p2 sub -> S plus ;
try_3 : (g:gender) VP g p3 -> NP g p3 sub -> S plus ;
to : (g:gender, p:person) (NP g p sub -> S minus ) -> VP g p ;
who : (g:gender) (NP g p3 sub -> S plus ) -> N g -> N g ;
whom : (g:gender) (NP g p3 obj -> S plus ) -> N g -> N g
end
signature Apres =
int : type;
truc : int
end
signature Logic =
unit : type ;
one : unit ;
i, o : type ;
JOHN, MARY, I, YOU : i ;
COOK, MAN, WOMAN, GOOD : i -> o ;
FIND, LOVE : i -> i-> o ;
TRY : i -> (i -> o) -> o
end
\ No newline at end of file
lexicon Sem_lex (Abstract) : Logic =
case := unit ;
gender := unit ;
person := unit ;
tense := unit ;
sub := one ;
obj := one ;
f := one ;
m := one ;
p1 := one ;
p2 := one ;
p3 := one ;
minus := one ;
plus := one ;
S := (x:unit) o ;
N := (x:unit) i => o ;
VP := (x:unit, y:unit) i -> o ;
NP := (x:unit, y:unit, z:unit) i ;
john := JOHN ;
mary := MARY ;
i := I ;
me := I ;
you := YOU ;
myself := lambda f. Lambda x. f x x ;
yourself := lambda f. Lambda x. f x x ;
herself := lambda f. Lambda x. f x x ;
himself := lambda f. Lambda x. f x x ;
cook := Lambda x. COOK x ;
man := Lambda x. MAN x ;