sentence(sentence(NP,VP)) --> noun_phrase(NP), verb_phrase(VP). noun_phrase(np(D,N)) --> determiner(D), noun_phrase2(N). noun_phrase(np(N)) --> noun_phrase2(N). noun_phrase2(np2(A,N)) --> adjective(A), noun_phrase2(N). noun_phrase2(np2(N)) --> noun(N). verb_phrase(vp(V)) --> verb(V). verb_phrase(vp(V,N)) --> verb(V), noun_phrase(N). % Vocabulary determiner(det(the)) --> [the]. determiner(det(a)) --> [a]. noun(noun(pieplate)) --> [pieplate]. noun(noun(surprise)) --> [surprise]. adjective(adj(decorated)) --> [decorated]. verb(verb(contains)) --> [contains]. % Program 19.7: A DCG computing a parse tree