Consider the context-free grammar (variation of the example from the textbook):
S -> NP VP
NP -> CN | CN PP
VP -> CV | CV PP
PP -> P CN
CN -> A N
CV -> V | V NP
A -> a | the
N -> armadillo | bat | cat | dog
V -> talks | likes | jumps
P -> with | for
- Give two strings that are generated by the grammar.
- Give two strings that are not generated by the grammar.
- What is the shortest string generated by the grammar?
- What is the longest?