Contents    Page-10    Prev    Next    Page+10    Index   


A grammar specifies the legal syntax of a language. The kind of grammar most commonly used in computer language processing is a context-free grammar. A grammar specifies a set of productions; non-terminal symbols (phrase names or parts of speech) are enclosed in angle brackets. Each production specifies how a nonterminal symbol may be replaced by a string of terminal or nonterminal symbols, e.g., a Sentence is composed of a Noun Phrase followed by a Verb Phrase.

<S>     -->  <NP> <VP>
<NP>    -->  <ART> <ADJ> <NOUN>
<NP>    -->  <ART> <NOUN>
<NP>    -->  <ART> <NOUN> <PP>
<VP>    -->  <VERB> <NP>
<VP>    -->  <VERB> <NP> <PP>
<PP>    -->  <PREP> <NP>

<ART>   -->   A | AN | THE
<NOUN>  -->   BOY | DOG | LEG | PORCH
<ADJ>   -->   BIG
<VERB>  -->   BIT
<PREP>  -->   ON