[antlr-interest] Re: Automated testing of lexer/parser rules

anakreonmejdi anakreonmejdi at yahoo.gr
Tue Apr 6 15:52:19 PDT 2004


--- In antlr-interest at yahoogroups.com, Bharath S <payasam79 at y...>
wrote:
> Hi Grp,
> 
> Can somebody provide information on how to automate
> the testing of lexer/parser rules? I usually put my
> test cases in a text file and feed it to my main
> program using the direction operator. I am using Antlr
> in Eclipse IDE and would like to automate testing
> using JUnit. Can someone shed some light on this?
> 
> Thanks!
I have developed a method for my project.
The concept is to store the AST in a XML format, and test if the AST
generated in an other time when the gramma definition has changed is
the 
same as that stored in the XML format.
The XML format looks like this:
<ast name="METHOD_CALL" text="abs">
  <ast name="ARGLIST_VALUES">
    <ast name="IDENTIFIER" text="some_var" />
  </ast>
</ast>
There is one class which extends TestCase from JUnit which performes
the comparasion between the AST defined in the XML format, and the AST
 the gramma produced from an input file.

With this methodology I can test the Parsers and TreeParsers I've
writen, but Lexers however are not tested directly.  



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list