[antlr-interest] Testing a grammar
Martin Probst
mail at martin-probst.com
Wed Mar 15 12:23:54 PST 2006
> > I think Terence wrote something like that once, a tool that generates
> > random and meaningless, but syntactically correct, expressions from your
> > grammar. Maybe in the filesharing section?
> >
> That strikes me as something that might test the program that uses the
> parser but it would hardly test the parser. After all, the test input is
> guaranteed to obey the rules of the parser.
That's right, it's more like a test that you're parser is stable, e.g.
doesn't throw NPEs or segfaults for the C++ side of life.
I should be pretty easy to write a coverage tool for the parser that
checks that every rule and subrule has been passed at least once (and
every loop has been run at least 2 times, etc.) by modifying the code
generator - that might be very useful, too.
Martin
More information about the antlr-interest
mailing list