Abstract:In this paper, a method is presented to partition productions of CFG (context-f ree grammar). It divides production set into two parts. The derivation with prod uctions in one part will never terminate, while it must terminate rapidly with p roductions in the other part. It is proved that the procedure of generating sent ences of CFL (context-free language) is using productions in one part to make t he sentential form longer and more complex first, and then using productions in the other part to terminate the procedure. A general controllable method is atta ined for generating sentences of CFL with restricted length or depth. The time a nd space complexity for generating one sentence is O(r+n), where n is th e restricted length or depth of sentences and r is the number of productions in given CFG. The generating strategies for different conditions are also discu ssed.