[antlr-interest] Semantic predicate hoisting - How to turn off? (somewhat urgent)
Terence Parr
parrt at cs.usfca.edu
Tue May 29 13:36:02 PDT 2007
Hi. Predicates cannot in general reference local variables or
parameters because they can be hoisted out of that rule. Usually
this is no problem. I suspect your use of $f and so on is not
correct as it probably references a labeled element after the
predicate. try stuff like input.LT(1) etc...
Ter
On May 29, 2007, at 12:16 PM, Panayiotis wrote:
> Hi!
>
> In ANTLR 3 is the new semantic predicate hoisting feature turned on
> by default?
> I believe it is, because I'm getting javac errors like:
>
> [21:47:11] \tmp\antlrworks\pclParser.java:4225: cannot find symbol
> [21:47:11] symbol : variable f
> [21:47:11] location: class pclParser
> [21:47:11] if ( (((evalPredicate
> (we,"$we.is_l_value")&&evalPredicate(f,"$f.is_l_value"))||
> evalPredicate(we,"$we.is_l_value"))) ) {
>
> when in fact "$we.is_l_value" and "$f.is_l_value" never appear in
> the same rule. Either that or am I doing something fundamentally
> wrong :-) .
> There were literally dozens of similar errors that disappeared as
> soon as I added the option "k=1;". Is there a similar option to
> disable predicate hoisting and any other advanced features ANTLR
> may have enabled by default?
>
> I need to get this working within the week, so I'll greatly
> appreciate any help you can offer me!
More information about the antlr-interest
mailing list