[antlr-interest] Re: Problem with x: (A)(B)? ;

mzukowski at yci.com mzukowski at yci.com
Fri Feb 27 15:40:20 PST 2004


Your assumption conflicts with how ANTLR sees things.  It assumes EOF will
come after any start rule, you are assuming that won't be the case.  

This behavior is more like searching than parsing.

Adding 
startLoop: (start)+;
Would satisfy lookahead requirements (look at generated code), however on
your second call  to start() will everything still be in sync?  I would
think so as long as you don't alter the stream in any way.

Of course I have to ask why not call startLoop() and have an action in there
to process every "start" unit of work?

Are you doing interactive parsing by any chance, like a command line
interface?  My approach here won't work for that.

Monty

-----Original Message-----
From: dotlessbraille [mailto:easjolly at ix.netcom.com] 
Sent: Friday, February 27, 2004 3:32 PM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] Re: Problem with x: (A)(B)? ;

Should start: (A(B)?|B|C|NEWLINE|EOF)
match an A that is followed in the token stream by something other 
than B or EOF?

(I'm assuming this rule is being invoked repeatedly by a driver so 
that token streams like AAAA or BCBCBC would get processed as a 
result of multiple invocations of start().)



 
Yahoo! Groups Links



 


 
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