Fwd: [antlr-interest] Lexer not as smart as it should be?
mansuk at gmail.com
Fri Oct 21 23:44:54 PDT 2005
On 10/22/05, Martin Probst <mail at martin-probst.com> wrote:
> > This seems to work as well(atleast no non-determinism error). As antlr
> > generates codes, which itself is means that there is no
> > non-determinism.
> That is not correct. ANTLR will generate code even if there are non-
> determinisms. That's why they are warnings, not errors. The code might
> still not work as you expect it to.
I did not see any warnings or errors for that grammar though.
I tried some examples, but can you give me an example where the above
> However, what you have ( if (int(...) < )...) is not a syntactic but a
> semantic predicate. That's just a posh name for host-code injected into
> the parser at certain places. Depending on what you do, that will be
> slow or fast. E.g. calculating 1.000.000 digits of Pi will be slow, but
> a single integer comparison is usually quite fast ;-)
So, can i take this as a rule of thumb:
" If i am using an If in the action to check some property of the a
label, it can be made a semantic predicate in the rule".
More information about the antlr-interest