wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

Consider the following statements about the context-free grammar
G = {S→ SS, S → ab, S → ba, S→ ϵ }
1. G is a ambiguous.
2. G produces all strings with equal number of a's and b's.
3. G can be accepted by a deterministic PDA
Which combination below expresses all the true statements about G?

Open in App
Solution

G = {S→ SS, S → ab, S → ba, S→ ϵ }
1. "G is ambiguous" is true since ϵ has infinite number of derivations some of which are shown below:

2. "G produces all strings with equal number of a's and b's", is false since L(G)=(ab+ba) and this language cannot produce all strings with equal number of a's and b's. For example aabb has equal number of a's and b's but aabb ∉ L(G).
3."G can be accepted by a DPDA" is true, since L(G) =(ab+ba) and this is a regular language, since we have written a regular expression for it. Since every regular language is also a DCFL, a DPDA exists. which accepts this language.

flag
Suggest Corrections
thumbs-up
0
similar_icon
Similar questions
View More
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Construction of CFG Part - 1
OTHER
Watch in App
Join BYJU'S Learning Program
CrossIcon