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