[antlr-interest] Random code generator

Arturo Hernandez arthernan at hotmail.com
Tue May 31 10:51:58 PDT 2011


Hello everybody, 

This is my first post to antlr-interest. I am halfway through the reference book, and so far I really like ANTLR. I do have some experience, since I hand coded a translator before, and the final translated software product is operational. It was a significant amount of code. But I have never used ANTLR.
My question is related to random test generation, is ANTLR the right tool to produce a random valid output for a given grammar?
I am trying to implement a functional/data driven approach to my everyday programing and such a tool would be very useful.
While generating this pseudo-random output a useful set of words to output is very important. Also some kind of biasing mechanism, to tilt the randomness in some cases in favor of one element vs another. Or maybe a correlation variable. Even a bounded coverage option to guarantee that "all options" have been covered in generation, would be beneficial.
My intention is that once the grammar is captured, we can generate text or streams that embody our grammar. I believe our thought is better spent on the grammar than on producing biased and superficial test codes.
Lastly with a good choice of words we just may be able to produce very funny examples, maybe a teacher or two will enjoy that.

Does anyone have any insight on this problem, including but not to be limited to "ANTLRXP does that!!"

Arturo Hernandez 		 	   		  


More information about the antlr-interest mailing list