/    /  Compiler Design-Predictive Parsers

Predictive Parsers

 

A Predictive parser is a recursive descent parser with no backtracking or backup. It is a top-down parser that does not require backtracking.

 

The choice of the rule to be expanded is made upon the next terminal symbol. 

 

Predictive Parser Algorithm

  1. For every grammar rule, make a transition Diagram(NFA/DFA)
  2. Reduce the no of states and optimize the transition diagram.
  3. To parse a string, stimulate the string on the transition diagram.
  4. It is parsed if the transition diagram reaches an accept state.

 

Reference Link

Predictive Parsers