[antlr-interest] Predicate hoisting/lowering confusion

Terence Parr parrt at cs.usfca.edu
Mon Jun 18 17:12:17 PDT 2007


On Jun 19, 2007, at 1:29 AM, Wincent Colaiuta wrote:
> parser code I can see how it gets "hoisted" up into the DFA of a  
> calling rule. The thing which puzzles me is that it is also being  
> "lowered" down into a rule further down the chain, and most  
> confusingly of all, the sense of the predicate is inverted in the  
> lower rule:

I believe it's because FOO+ requires that it figure out what follows  
it to determine if it should exit.  That means FOLLOW(pre), which is  
FOLLOW(element), which is FIRST(element) which is FIRST(pre).  It  
sucks the pred back in.

Ter



More information about the antlr-interest mailing list