Find grammars for ab that generate the sets of a all string
Find grammars for = {a,b} that generate the sets of
 (a) all strings with exactly two a\'s.
 (b) all strings with at least two a\'s.
 (c) all strings with no more than three a\'s.
 In each case, give convincing arguments that the grammar you give does indeed generate the indicated language.
Solution
part (a)
S -> bA | aA | aB
 A -> bA | aB | aC
 B -> bB | 
 C -> aB
part (b)
S -> bA | aA | aB
 A -> bA | aA | aC
 B -> bB | 
 C -> aB
part (c)
S -> bS | aA | 
 A -> bA | aB | 
 B -> bB | aC | 
 C -> bC | 

