Skip to content

Commit

Permalink
Change example to use numerus as an additional argument
Browse files Browse the repository at this point in the history
  • Loading branch information
fnogatz committed Oct 24, 2018
1 parent c3946dd commit a021a2b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ Extend Definite Clause Grammars (DCG) for Prolog by an additional argument to au
% Extended DCGs get expanded to hold additional
% argument with syntax tree.
sentence ==> noun_phrase, verb_phrase.
noun_phrase ==> determiner, noun.
verb_phrase ==> ( verb ; verb, noun_phrase ).
noun ==> [boy] ; [boys] ; [apple] ; [apples].
sentence ==> noun_phrase(N), verb_phrase(N).
noun_phrase(N) ==> determiner, noun(N).
verb_phrase(N) ==> ( verb(N) ; verb(N), noun_phrase(_) ).
noun(sg) ==> [boy] ; [apple].
noun(pl) ==> [boys] ; [apples].
determiner ==> [the].
verb ==> [eat].
verb ==> [eats].
verb(sg) ==> [eats].
verb(pl) ==> [eat].
main :-
phrase(sentence(Tree), [the, boy, eats, the, apples]),
Expand Down

0 comments on commit a021a2b

Please sign in to comment.