[antlr-interest] generating random sentences
Terence Parr
parrt at cs.usfca.edu
Sat Feb 5 11:42:48 PST 2005
Howdy,
For testing ANTLR, i made a quick method that operates on my internal
NFA data structure to generate random sentences. This will work with
any input grammar of course and would be useful to send in random, but
grammatically correct, input to a translator to ensure the program
doesn't crash etc...
Just thought people would find it interesting...related to the unit
testing discussion previously.
For example, given
a : (A | B) X ;
you'll get either AX and BX output. Each branch is chosen with equal
probability. :)
Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
More information about the antlr-interest
mailing list