[antlr-interest] question about nondeterminism
Terence Parr
parrt at cs.usfca.edu
Sat Feb 28 11:36:35 PST 2004
Hi. I'm afraid this is the quintessential case where the approx LL(k)
in this version of ANTLR falls down. For example,
test: "A" "X"
| "X"
| "A" "Y"
| "Y"
;
works, but is not probably easy to pull into one rule for your real
grammar.
I'm apologize for the counter-intuitive grammar analysis algorithm. I
had to build it in a hurry years back and approx was easier than full
LL(k) :( Plus java was SO slow back then.
Ter
PS ANTLR 3 will handle to full LL(k) and beyond into LL-regular
On Feb 28, 2004, at 3:20 AM, cj_daly wrote:
> I've got antlr 2.7.2. Can anyone explain why the following grammar
> gives nondeterminism warnings? I would think that with enough
> lookahead there should should be no ambiguity, but maybe I am
> misunderstanding "nondeterminism".
>
> Is this ignorable?
>
> Without refactoring the rules is there some way (options?) to make the
> warning go away? (I know I could pull the ("A")? up into the test
> rule before the foo|bar alternative but I'm trying to avoid that.)
>
> below is the grammar:
>
> ////
> class TestParser extends Parser;
>
> options { k=2; }
>
> test : foo | bar;
>
> foo : ("A")? "X";
> bar : ("A")? "Y";
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!
Cofounder, http://www.peerscope.com pure link sharing
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