[antlr-interest] A proposal for keywords
shmuel siegel
antlr at shmuelhome.mine.nu
Wed May 24 15:51:07 PDT 2006
Loring Craymer wrote:
> Shmuel--
>
> This is an implementation problem. To specifically look for a token with
> text "0" and type NUMBER would require running an interpreted version of the
> lexer over keyword tokens in the parser grammar during ANTLR analysis. You
> can "manually" differentiate and identify already (ANTLR 3, not ANTLR 2)
> with a semantic predicate. As long as there is machinery for fine-tuning, I
> would rather see a simple mechanism that handles most of the cases than
> request significant extra machinery. Ter has enough to do already.
>
> --Loring
>
I was thinking that the basis of the mechanism that I wanted was already
there. ANTLR3 already has a sophisticated mechanism for detecting
ambiguous rules. I thought that the DFA for the lexer can be configured
to return a token set. The definition of "match" then changes to contains.
But ultimately I agree with you. Since I can manually handle it with
slightly awkward syntax, it is not worth delaying ANTLR 3.0 for this
feature. If it causes a significant delay or a risk of introducing bugs,
delay it till version 3.1
Shmuel
More information about the antlr-interest
mailing list