Abstract:This paper introduces an automatic program generator for testing compiler, which acceptes the context-free grammar of the compiled language as its input. According to the features of the language, we represent its basic elementes with some table-structures , and solve the context-sensitive problem of language effectively by operating on them. The generator can automatically produce not only the programmes that overlay all grammar conditiones, but also the programmes which have some special grammar conditiones but also the programmes which have have some special grammar conditions for users.The generator itself has some features in its generation-strategy,generation_algorithm and deravation-principle.