[antlr-interest] Q: How to understand 'multiple alternatives'?
Austin Hastings
Austin_Hastings at Yahoo.com
Sat Aug 16 08:46:19 PDT 2008
Howy,
I'm parsing a C-like language, and I'm getting this kind of warning:
warning(200): perl6/hlasm/Hlasm.g3:245:4: Decision can match input such
as "'&'" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
In several places. In fact, the '&' (and several other characters) can
have different roles to play in the language. In this case, & can either
be a bitwise and, or an address operator.
However -- and this is what confuses me -- I can't seem to see what
antlr is griping about. According to me, and expression like
a & b
should not be confusable with
&foo
so I'm wondering why antlr seems to feel that there are different
alternatives that can parse the &.
Obviously, either there's a problem with antlr or a problem with my
grammar. I'd like it to be with my grammar, since I can likely fix that.
So my question is, how do I understand what the multiple alternatives
are, here? I tried dumping the nfa/dfas, to little avail.
Recommendations, advice?
=Austin
More information about the antlr-interest
mailing list