[antlr-interest] Re: Building hierarchical grammars

Mike Lischke lists at lischke-online.de
Sun Mar 28 11:12:32 PST 2004


Hi Mark, 

Thank you very much for your quick help (also with my other question). After moving some rules around, rebuilding the
number literal rule and making a few things protected my lexer grammer now compiles fine. Phew, now I can finally start
testing :-)

> In general, Lexers are not 'hierarchical', Parsers are.  
> Different parser rules can match similar things because they 
> are called from other rules:

However, building things up hierarchically works great with ANTLR. But maybe only when build the hierarchy up with
protected tokens?
 
> Lexers, on the other hand, have to pick from among ALL the 
> Lexer rules each and every time they are asked for the next 
> token.  They don't 'know' where they are called from in the 
> parser, and so can't restrict the set of token parses for a 
> particular case.

Thanks for pointing this out. This is an important point IMO, also when it comes to performance. And it explains a lot.

Mike
--
www.soft-gems.net




 
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