[antlr-interest] Exception tests eat performance?

Karl Meissner meissnersd at yahoo.com
Wed Jan 7 10:44:48 PST 2004


--- Terence Parr <parrt at cs.usfca.edu> wrote:
> Hi gang, my only additional comment would be that using return values 
> makes it pretty hard to have other return values from a rule, which are 
> arguably very handy.

Which is why I used in my  psuedo code ;-)

But fine, I used returned values in my rules all the time too. 
The traditional alternatives to a return value are

1) reference parameters

void Rule123( .... , ref ResultInfo result) { 

   result = null; // assume success;


   if( someproblem) result = new ResultInfo();    
    
}


2) Sticking the result into some globally accessable place such as a member.  Results could even
be held in a stack, equivlent to inputState.guessing.  

    ....
    Rule456( ); 
    if(  globalResultState != null )  break; 





__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

 

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