Example(2): Solution : Let we will construct a CFG G=(V,T,P,S) Here, T={0,1}, V={S U [ q ,A , q ], [ q ,A , q 1 ], [ q ,S , q ], [ q ,S , q 1 ], [ q 1 ,A , q 1 ], [ q 1 ,A , q ], [ q 1 ,S , q 1 ], [ q 1 ,S , q ]} Now let up build the production rules as: Using rule1 from the algorithm P1: S-> [ q ,S , q ] P2: S-> [ q ,S , q 1 ] Using rule3 of algorithm for the ( q 0, 1,S)={ ( q 0, AS )} we get, P3: [q ,S , q ]->1[q ,A , q ][q ,S , q ] P4: [q ,S , q ]-> 1[q ,A , q 1 ][ q 1 ,S , q ] P5: [ q ,S , q 1 ]-> 1[q ,A , q ][ q ,S , q 1 ] P6: [ q ,S , q 1 ]-> 1[q ,A , q 1 ][ q 1 ,S , q 1 ]