[antlr-interest] Proper use of options {k=..}
Felix Dorner
felix_do at web.de
Mon May 26 08:19:59 PDT 2008
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