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

A CFG G is given with the following productions where S is the start symbol, A is a non-terminal and a and b are terminals.
S aS | A
A aAb | bAa | ε
Which of the following strings is generated by the grammar above?


Open in App
Solution

Given grammar will generate string aabbaab
Whose derivation is given below:
S aS
S aA
S aaAb
S aabAab
S aabbAaab
S aabbaab


flag
Suggest Corrections
thumbs-up
0
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