1. S Þ aSB | l
2. B Þ bb | b
Discussion: Rule-1 provides machinery for generating as many leading a's as needed, specified by i. Rule-2 generates one or two b's for each a.
1. S Þ AC
2. A Þ aAbb | l
3. C Þ cC | l
Discussion: Rule-1 set up the machinery for producing substrings made up of a's and b's by variable A and the substrings made up of c's. Repeated application of Rule-2 produces substrings which have a's followed by twice as many b's. Rule-3 simply generates as many c's as necessary, specified by j.
Try to construct a grammer for
generating { ajbic2i | i,j ³ 0 }