[antlr-interest] Proper use of options {k=..}
Terence Parr
parrt at cs.usfca.edu
Mon May 26 09:57:39 PDT 2008
not in this version. a future version will have a "hushcode" that will
turn off a warning for a specific decision.
Ter
On May 26, 2008, at 8:19 AM, Felix Dorner wrote:
> Hi,
>
> In my backend, I need to distinguish various kinds of "equality
> expressions" of the general form
>
> ^(EQ expression expression)
>
> to simplify the generated code as much as possible. For example,
> "nil == someExpression" can be simplified. I capture those special
> expressions with subrules. Antlr now warns me, for example that
> ^(EQ L_NIL ...) can be matched by both rules and he disabled the
> second rule for this case. This is perfectly what I want I guess. I
> wonder if there's a way
> to get those warnings away?
>
> equalityExpression
> options{k=3;}
> // nil == expression -> output can be simplified
> : ^(EQ L_NIL e2=expression)
> -> nil_identical(rhs={$e2.st})
> | ^(EQ e1=expression e2=expression)
> -> identical(lhs={$e1.st},
>
> lhsType={map($e1.start.evalType().getQualifiedName())},
> rhs={$e2.st})
> ;
>
>
More information about the antlr-interest
mailing list