Consider the following grammar G S→bS|aA|b A→bA|aB B→bB|aS|a
Let Na(w)andNb(w) denote the number of a's and b's in a string w respectively. The language L(G) ⊆ {a,b}+generated by G is
Open in App
Solution
Draw the fa of the given grammar as shown below:
Clearly, the machine is accepting Na(w)=3k,where k ϵ {0,1,2,3,...}