given a grammar this produces the required no of sentences