% Grammar 2
% =========

% signature file
signature(signature).

         
% phrase structure rules

subject_head_rule rule
(phrase,
 phon:MotherPhon,
 synsem:(category:(head:Head,
                   subcat:[]),
         content:Content))
   ===>
cat> (phon:SubjPhon,
      synsem:Synsem),
cat> (phon:HeadPhon,
      synsem:(category:(head:Head,
			      subcat:[Synsem]),
		    content:Content)),
goal> phon_append(SubjPhon,HeadPhon,MotherPhon).


head_complement_rule rule
(phrase,
 phon:MotherPhon,
 synsem:(category:(head:Head,
                   subcat:(ne_list, Rest)),
         content:Content))
   ===>
cat> (phon:HeadPhon,
      synsem:(category:(head:Head,
			subcat:[First|Rest]),
              content:Content)),
cat> (phon:CompPhon,
      synsem:First),
goal> phon_append(HeadPhon,CompPhon,MotherPhon).




% Lexical entries

i ---> (word,
	phon:[(a_ i)],
	synsem:(category:(head:case:nom,
                          subcat:e_list),
                 content:(index:(person:first,
                                 number:sing)),
                 context:(backgr:[]))).

me ---> (word,
	 phon:[(a_ me)],
	 synsem:(category:(head:case:acc,
                           subcat:e_list),
                  content:(index:(person:first,
                                  number:sing)),
                  context:(backgr:[]))).

she ---> (word,
	  phon:[(a_ she)],
	  synsem:(category: (head:case:nom,
                            subcat:e_list),
                 content: (index: (X, (person:third,
                                       number:sing,
                                       gender:fem))),
                 context: (backgr:[(female_rel, arg1:X)]))).

her ---> (word,
	  phon:[(a_ her)],
	  synsem:(category: (head:case:acc,
                            subcat:e_list),
                 content: (index: (X, (person:third,
                                       number:sing,
                                       gender:fem))),
                 context: (backgr:[(female_rel, arg1:X)]))).


walk ---> (word,
	   phon:[(a_ walk)],
	   synsem: (category:(head:vform:fin,
                              subcat:[(category:head:case:nom,
                                       content:index: (Index,
						       (person:first,
                                                        number:sing
                                                      )))]),
                  content:(walk_rel,
                           arg1:Index),
                  context: (backgr:[]))).


walks ---> (word,
	    phon:[(a_ walks)],
	    synsem: (category: (head:vform:fin,
                             subcat:[(category:head:case:nom,
                                     content:index: (X,(person:third,
                                                       number:sing
                                                      )))]),
                  content:(walk_rel,
                           arg1:X),
                  context: (backgr:[]))).

love  --->  (word,
	     phon:[(a_ love)],
	     synsem: (category:(head:vform:fin,
                                subcat:[(category:head:case:acc,
                                         content:index: Y),
                                        (category:head:case:nom,
                                         content:index: (X,
                                                         person:first,
                                                         number:sing))]),
                 content: (love_rel,
			   arg1:X,
			   arg2:Y),
                 context: (backgr:[]))).

loves --->  (word,
	     phon:[(a_ loves)],
	     synsem: (category:(head:vform:fin,
                                subcat:[(category:head:case:acc,
                                         content:index: Y),
                                        (category:head:case:nom,
                                         content:index: (X,
                                                         person:third,
                                                         number:sing))]),
                 content: (love_rel,
			   arg1:X,
			   arg2:Y),
                 context: (backgr:[]))).



% Definite relations

phon_append([],[],[]) if !, true.
phon_append([],[H|T1],[H|T2]) if phon_append([],T1,T2).
phon_append([H|T1],L,[H|T2]) if phon_append(T1,L,T2).



