Contents
Page-10
Prev
Next
Page+10
Index
Language Generation
Sentences can be generated from a grammar by the
following procedure:
- Start with the sentence symbol, <S>.
- Repeat until no nonterminal symbols remain:
- Choose a nonterminal symbol in the current string.
- Choose a production that begins with that nonterminal.
- Replace the nonterminal by the right-hand side of the production.
<S>
<NP> <VP>
<ART> <NOUN> <VP>
THE <NOUN> <VP>
THE DOG <VP>
THE DOG <VERB> <NP>
THE DOG <VERB> <ART> <NOUN>
THE DOG <VERB> THE <NOUN>
THE DOG BIT THE <NOUN>
THE DOG BIT THE BOY