Prolog, as a convenience, will do most of the tedious work for you. What follows, is the way you can take advantage of Prolog.
This is how we can define the simple grammar which is accepted `as is' by Prolog.
sentenceIt is very easy to extend if we want to include adjectives.
noun_phraseThis formulation is sometimes known as a Definite Clause Grammar (DCG).
-->determiner, adjectives, noun.
We might later think about the ordering of these rules and whether they really capture the way we use adjectives in general conversation but not now.
Essentially, the Prolog Grammar Rule formulation is syntactic sugaring. This means that Prolog enables you to write in:
sentenceand Prolog turns this into:
adjective(A,A0):-where 'C'/3 is a built in Prolog Predicate which is defined as if: