Question: Context - free Grammars: 1 - Show a context - free grammar for each of the following languages L: a ) { anbm : m
Contextfree Grammars:
Show a contextfree grammar for each of the following languages L:
aanbm : m n mn is odd
bw in a b : each even length prefix of w contains at least twice as many as as bs
Let L be the language generated by the following contextfree grammar:
S R T
R a R a R b
T b T b T a
a List the first six strings in L in lexicographic order.
b Give a clear formal description of L using set notation, as in question #
For each of the following languages L state whether L is regular or contextfree but not regular. If L
is regular, show a regular grammar for it Otherwise, show a contextfree grammar.
a bw in a b : w x aa xR for some string x in a b
w in a b : w does not contain any substring of three consecutive as
Consider the following grammar for a fragment of English:
S NP VP
NP the Nominal a Nominal Nominal ProperNoun NP PP
Nominal N Adjs N
N pizza omelets pepperoni eggs whisk bacon
ProperNoun Kim Dominos
Adjs Adj Adjs Adj
Adj green deepdish fluffy greasy
VP V V NP VP PP
V like likes beat beats sell sells
PP Prep NP
Prep with
Give an example of a sentence that is ambiguous with respect to this grammar. Show two parse
trees for your sentence.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
