[antlr-interest] Fun with ANTLR3: mystery of the huge lexer
qwertie256 at gmail.com
Sat Jun 30 17:30:20 PDT 2007
> The lexer will assign the priority from top to bottom in listed order so
> you should be able to achieve what you need - I find you get simpler
> lexers though if you code the rule yourself to eliminate clashes and use
> $type = xxx;.
It turns out they are already in the right order, but the problem is
these truly gigantic state transition tables. I may have to combine
all three rules into one to resolve the problems in a more intimate
way, but one of the reasons I decided to "tough it out" with ANTLR 3
(despite a lack of good tutorials*) was I hoped it would be possible
to avoid such things.
(*Even the ANTLR book isn't as good as this ANTLR 2 tutorial, IMO:)
> User operators eh, how do they specify precedence?
With numbers. In fact, they can even have a different precedence on
the left and right sides of a binary operator, as well as making
ternary and other complex operators. I'm still developing the
algorithm but I think it will work.
More information about the antlr-interest