Lookahead
Lookahead
- A yacc parser cannot handle grammers that need more than one token of lookahead to tell whether a rule has been matched.
phrase1: cart-animal AND CART ;
phrase2: work-animal AND PLOW ;
cart-animal: HORSE | GOAT ;
work-animal: HORSE | OX ;
- The input “HORSE AND CART” requires two symbol lookahead.