[antlr-interest] Grammar seems to produce incorrect parser

Ric Klaren klaren at cs.utwente.nl
Thu Jan 22 06:56:50 PST 2004


On Thu, Jan 22, 2004 at 03:35:39PM +0100, Ric Klaren wrote:
> For starters try:
> 
> expression 
> :	simpleExpression ("is" "null")? EOF 
> ;
> 
> This of course will only work for input with a single expression followed
> by end of file. If you want it to stop parsing after one expression leaving
> the rest of the stream untouched then it won't work :/

Come to think of it you could also cheat by adding a dummy rule:

cheat: expression . ;

This will only bomb if it encounters unknown tokens...

Cheers,

Ric
--
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
  Wit is cultured insolence. --- Aristotle

 

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