Go backward to Implementing CFGs in Prolog
Go up to Context Free Grammars And How To Implement Them In Prolog
- The grammar discussed in the example above can be found in
Extend it to include rules corresponding to
Add (more) lexicon rules for determiners, nouns, verbs and
prepositions to the grammar. Use your grammar to see if
strings that you make up from the words are grammatical.
-> det, noun
-> verb, pp
-> prep, np
- Add some more rules for VPs.
How would you write a phrase structure rule where the LHS
rewrites as three symbols on the RHS? Try to write rules for give,
as in give John a bird and give the bird to John.
- Try generating sentences from the grammar (use the query
s(X), hitting ; to see the various
combinations). What do you think?