Skip to main content
1 of 2
Chris Dodd
  • 795
  • 2
  • 4

In traditional shift/reduce or bottom-up parsing, this is called a "reduce/reduce conflict" and needs to be resolved somehow

  • using information from what you've seen already. This is what happens in a language like C using an LR parser -- you have a state machine that knows whether to expect an expression or an argument-expression-list (probably based on whether you're trying to parse an argument list or not)

  • using lookahead. Looking at future tokens to try to figure out which alternative to use.

  • using trial and backtracking -- try one, and if it doesn't work out, backtrack to this point and try the other.

Chris Dodd
  • 795
  • 2
  • 4