% ==========================================================================
% $Id: sentence.pl,v 1.1 2014/02/13 05:47:11 jlang Exp $
% CSI2120 example Code for lecture 9
% ==========================================================================
% (C)opyright:
%
%   Jochen Lang
%   EECS, University of Ottawa
%   800 King Edward Ave.
%   Ottawa, On., K1N 6N5
%   Canada. 
%   http://www.eecs.uottawa.ca/~jlang
% 
% Creator: jlang (Jochen Lang) based on Clocksin & Mellish
% Email:   jlang@eecs.uottawa.ca
% ==========================================================================
% $Log: sentence.pl,v $
% Revision 1.1  2014/02/13 05:47:11  jlang
% Added grammar examples for lecture 9.
%
% ==========================================================================
sentence(X,Z) :-
    noun_phrase(X,Y), verb_phrase(Y,Z).

noun_phrase(X,Z) :-
    determiner(X,Y), noun(Y,Z).

verb_phrase(X,Z) :-
    verb(X,Z).
verb_phrase(X,Z) :-
    verb(X,Y), noun_phrase(Y,Z).

determiner([the|Z],Z).
determiner([a|Z],Z).
noun([tomato|Z],Z).
noun([bird|Z],Z).
noun([man|Z],Z).
noun([cat|Z],Z).
verb([eats|Z],Z).
verb([sings|Z],Z).
verb([loves|Z],Z).
