Question: L = { w in { a , b , c } * : a b c | n = m / 2 or n

L ={ w in {a,b,c}*: abc| n = m/2 or n = k -2 ; where n >=0, m is even & k >=2}
Let's say, we have the following 4 CFGs labeled as (A) to (D).
CFG A:
S -> XY | PQ
X -> aXbb |\epsi
Y -> ccY | c
P -> aP | b
Q -> bQc | c
CFG B:
S -> XY | PQ
X -> aXb |\epsi
Y -> cYb | c
P -> aP |\epsi
Q -> bQcc | c
CFG C:
S -> XY | PQ
X -> aXb | c
Y -> cYb |\epsi
P -> aP |\epsi
Q -> bQcc | c
CFG D:
S -> XY | PQ
X -> aaXb |\epsi
Y -> cY | cc
P -> aaP |\epsi
Q -> bQc | cc
What will be the correct CFG for the language L?
Note, for a language L, the CFG will be correct if and only if it can parse all the strings, w in L, and doesnt parse any string, w L.
2 points
A
B
C
D

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!