%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% %% Pereira and Shieber, Program 3.12 pp.78-9 %% %% (corrected) %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% Stuff to overcome Sictus' ever-so-helpful abbreviation of list terms portray(Term) :- is_list(Term), write(Term). is_list([]). is_list([_|_]). %%%% End of stuff s --> np, vp. np --> det, n, optrel. np --> pn. vp --> tv, np. vp --> iv. optrel --> []. optrel --> [that], vp. det --> [Det], {det(Det)}. det(a). det(the). det(some). det(every). n --> [N], {n(N)}. n(author). n(book). n(program). n(programmer). n(professor). n(student). pn --> [PN], {pn(PN)}. pn(begriffsschrift). pn(principia). pn(lunar). pn(shrdlu). pn(bertrand). pn(gottlob). pn(terry). pn(bill). tv --> [TV], {tv(TV)}. tv(pleased). tv(met). tv(ran). tv(wrote). iv --> [IV], {iv(IV)}. iv(halted). %| ?- s([bertrand, wrote, a, program, that, halted],[]). % %yes %| ?-