<sentence> --> <noun phrase> <verb phrase> <noun phrase> --> <adjective> <noun phrase> | <adjective> <singular noun> <verb phrase> --> <singular verb> <adverb> <adjective> --> a | the |little <singular noun> --> boy <singular verb> --> ran <adverb> --> quicklyHere, the arrow, -->, might be read as "is defined as" and the vertical bar, "|", as "or". Thus, a noun phrase is defined as an adjective followed by another noun phrase or as an adjective followed by a singular noun. This definition of noun phrase is recursive because noun phrase occurs on both sides of the production. Grammars are recursive to allow for infinite length strings.
This grammar is said to be context-free because only one syntactic category,
e.g.,
A grammar is an example of a metalanguage- a language used to
describe another language. Here, the metalanguage is the context-free
grammar used to describe a part of the English language.
Example 2 shows a diagram
called a parse tree or structure tree for
the sentence the little boy ran quickly.
The sentence: "quickly, the little boy ran" is also a syntactically
correct sentence, but it cannot be derived from the above grammar. In
fact, it is impossible to describe all the correct English sentences
using a context-free grammar.
On the other hand, it is possible, using the grammar above, to derive
the syntactically correct, but semantically incorrect string, "little
the boy ran quickly." Context-free grammars cannot describe semantics.
Send questions and comments to: Karen Lemone