% CPSC 312 2021W1
% Author: Steve Wolfman
%
% A simple grammar for sentences translated directly into Prolog.
%
% Released into the public domain.

s(Words) :- np(NPWords), vp(VPWords), append(NPWords, VPWords, Words).
np(Words) :- det(DetWords), noun(NounWords), append(DetWords, NounWords, Words).
vp(Words) :- verb(VerbWords), np(NPWords), append(VerbWords, NPWords, Words).

det([a]). det([the]).
noun([student]). noun([course]). noun([teacher]). noun([puppy]).
verb([likes]). verb([teaches]). verb([studies]). verb([tackles]).