[antlr-interest] newbie problem)reference to rewrite element name without reference on left of ->.

Randall R Schulz rschulz at sonic.net
Mon Jul 9 16:09:52 PDT 2007


On Monday 09 July 2007 16:04, ali azimi wrote:
> Hi,
>
>   I have a problem regarding rewrite error messages. The Rule1
> produces Error1 when I try to generate code from it. But when I
> enclose the parser grammar(before ->) in parenthesis (Rule2), there
> is no error message.
>
>
>      Why is that?

Operator precedence.

The rewrite rule operator, ->, binds more tightly than alternation 
("or" / vertical bar). In your Rule1 the first two alternatives have no 
explicit rewrite at all; only the last one, "timeridentifier" has an 
explicit rewrite action.


> ...
>
>   Al


Inter-caps or even underscores would help grammar readability, too.


Randall Schulz


More information about the antlr-interest mailing list