Tool for testing lexers/parsers/tree parsers

Bogdan Mitu bogdan_mt at yahoo.com
Mon Jan 7 07:11:27 PST 2002


Hi all,

I worked on a project using ANTLR default ASTs (speed was not a concern),
and I wrote a small utility to help me test the tree parsers. Later I
extended it to allow testing of parsers and lexers as well. I would like to
contribute this utility to ANTLR; I put the files in the ANTLR group
http://groups.yahoo.com/group/antlr-interest/files/tester.zip

A test file consists of a header and a series of tests. The header contains
at least the class name, the type (lexer, parser or tree parser) and the
rule to be tested (for parsers/tree parsers). The tests are pairs input -
expected output. The tester takes the input, feed the tool under test and
compare the output with the expected one. Tests that fail are displayed in
pop-up frames.

To run the tool you have to type java test.TestRunner <filename>. In the
root of the distribution you can find some .bat files for invoking a lexer,
a parser and a tree parser. In the "example" folder there is a sample
grammar bool.g and some sample tests (lexer.test, parser.test and
treeParser.test). Note that in each file the last test is wrong, just to
force frames to pop-up.

If you decide to give it a try, please let me know your comments.


Regards,

  


__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/



More information about the antlr-interest mailing list