84 views
Give a context-free grammar for the set of all strings over the alphabet {a, b} with exactly twice as many a’s as b’s. Explain the working of the grammar by characterizing the strings generated by each non-terminal.

## $S\rightarrow aSaSb|aSbSa|bSaSa|SS|\varepsilon$

It's from Sipser
by

1 vote