% Grammar 3
% =========

% specify signature file
signature(signature).

% load the lexicon

:- [lexicon].


% phrase structure rules
subject_head_rule rule
(phrase, phon:MotherPhon,
         synsem:(category:(head:H,
                           subcat:[]),
                 content:Content),
 dtr1:Subj, dtr2:Head)
   ===>
cat> (Subj,
      phon:SubjPhon,
      synsem:Synsem),
cat> (Head,
      phon:HeadPhon,
      synsem:(category:(head:H,
		        subcat:[Synsem]),
	      content:Content)),
goal> phon_append(SubjPhon,HeadPhon,MotherPhon).


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


%----------------------

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).



