[antlr-interest] RFE: warn if root rule is missing (no EOF)

Daniels, Troy (US SSA) troy.daniels at baesystems.com
Wed Feb 20 16:27:08 PST 2008


Both of you are right.  You're making different points.

1.  Not every grammar needs to reference EOF.  If your grammar does not
reference EOF and does exactly what you want it to do, it should not
generate a warning.

2.  Not adding EOF is a common beginner mistake and generates many,
similar messages to the email list.  Something should be done so that
beginners are aware that (almost always) you want to end your base rule
with EOF.


A reasonable solution to both points is a command line option that
prints an warning if no rule references EOF.  The warning should be
worded with the expectation that most users who see it will be new to
the tool.

"New" users will see the warning and add an EOF to their main rule,
rather than spending an hour trying to figure out why it doesn't work,
then bothering all of us with an email.

"Advanced" users who know that their grammar does not reference EOF and
why this is correct will be able to disable the option and suppress the
warning.  

Troy

 

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org 
> [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Loring Craymer
> Sent: Wednesday, February 20, 2008 6:39 PM
> To: Guntis Ozols; antlr-interest at antlr.org
> Subject: Re: [antlr-interest] RFE: warn if root rule is 
> missing (no EOF)
> 
> I think that you miss Jim's point.  It is not necessary for a 
> grammar to have a rule that references EOF.  For that matter, 
> it is possible to have rules reference EOF without being root 
> rules (I have to admit, though, that I have never seen an 
> instance where this would make sense).  All that the EOF does 
> is force a rule to read to end-of-file or throw a 
> "NoViableAlt" exception.
> 
> --Loring
> 
> ----- Original Message ----
> > From: Guntis Ozols <guntiso at latnet.lv>
> > To: antlr-interest at antlr.org
> > Sent: Wednesday, February 20, 2008 2:58:42 PM
> > Subject: Re: [antlr-interest] RFE: warn if root rule is missing (no 
> > EOF)
> > 
> > This is not a valid thing to do.
> > > Not everyone WANTs a rule to end in EOF.
> > >
> > > Jim
> > 
> > Of course this is not a valid thing to do if you want to 
> boost trafic 
> > for this list, keep newbies puzzled and everyone else on this list 
> > busy.
> > 
> > I am subscribed to this list only for few months, and seen this EOF 
> > issue (and other issues) pop up numerous times.
> > 
> > To keep everyone happy, there could be command line option 
> > 'help-dummies', which could enable this and other warnings.
> > Hopefully it can be 'on' by default.
> > 
> > Guntis
> > 
> > 
> 
> 
> 
> 
>       
> ______________________________________________________________
> ______________________
> Looking for last minute shopping deals?  
> Find them fast with Yahoo! Search.  
> http://tools.search.yahoo.com/newsearch/category.php?category=shopping
> 


More information about the antlr-interest mailing list