[antlr-interest] A few suggestions re. ANTLRWorks

Mark Volkmann r.mark.volkmann at gmail.com
Tue Feb 5 05:53:35 PST 2008


On Feb 5, 2008 7:41 AM, Nikolas Everett <nik9000 at gmail.com> wrote:
>
> On Feb 5, 2008 8:00 AM, Mark Volkmann <r.mark.volkmann at gmail.com> wrote:
>
> >
> > On Feb 4, 2008 10:45 PM, Jim Idle <jimi at temporal-wave.com> wrote:
> > >
> > > > -----Original Message-----
> > > > From: Olivier Lefevre [mailto:lefevrol at yahoo.com]
> > > > Sent: Monday, February 04, 2008 4:48 PM
> > > > To: antlr-interest at antlr.org
> > > > Subject: [antlr-interest] A few suggestions re. ANTLRWorks
> > > >
> >
> > > > Next comes the Input Text dialog. The Start Rule was set to a
> > > > (seemingly randomly chosen) rule in the grammar describing a single
> > > > line, so that the debugger terminated after the first line of input.
> > > > This drove me _nuts_ and it took me a while to realize (by chance)
> > > what
> > > > was going on.
> > > > It seems to me that the only sensible default for the Start Rule is
> > > the
> > > > topmost rule of the grammar, whatever that is, and that it should be
> > > > set to _that_ the first time.
> > >
> > > There is no real reason that the first rule is likely to be more correct
> > > as a target than any other. Choose your rule and it remembers your
> > > choice. There are many grammars where the 'start' rule depends on what
> > > you are testing. It might be more likely than not that the first rule
> > > listed is the start rule, but more likely that a rule ending with the
> > > EOF token is the start rule.
> >
> > I agree that the best first guess is to find the rule that ends in
> > EOF. However, if none do then guessing that the first rule in the
> > grammar is the start rule seems much better than the current,
> > seemingly random guess. Is it random? I haven't been able to detect a
> > pattern.
>
> I often test rules that don't end in EOF.  The best thing from my
> perspective would be to pick the first rule that parses EOF by default.  If
> no rules parse EOF, pick the first rule by default.  If I have already
> picked a rule, stick with it.

Agreed!

-- 
R. Mark Volkmann
Object Computing, Inc.


More information about the antlr-interest mailing list