[antlr-interest] while loop executing during tree walking

toltec_spb toltec at pisem.net
Sun Sep 8 15:13:30 PDT 2002


I need to execute while loop, the parser rule is:

while_ : WHILE^ LPAREN expression RPAREN DO (statement)* END ;

my tree walker rules:

while_ [bool OK]
{
VARIANT * pVal;
}
 : 
 #(WHILE LPAREN pVal=ex:expression RPAREN DO (ddo:statement[OK])* 
      	{
      		while (pVal->boolVal) 
      		{    		  
		  orphan_statement(ddo,OK);      		
      		  pVal=orphan_expression(ex);		  
     		}
      	}  
   END) 	
 ;

orphan_expression returns [VARIANT * pVal] : pVal=expression;

orphan_statement [bool OK] : (statement [OK])*;

The "while_" rule is executed only one time :( What can I do with my 
tree parser to solve this problem?? beforehand thank's


 

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



More information about the antlr-interest mailing list