A predictive parser has the potential to predict which production is to be used by the compiler to replace the input string.
The predictive parser has the advantage that it does not suffer from backtracking.
A lookahead pointer is used in In predictive parsing, which points to the next input symbols.
The predictive parser accepts only a class of grammar commonly called LL(k) grammar. So, a Predictive Parser can be considered as a LL(1) Parser.
How predictive parser work?
Following are the steps for constructing a predictive parser.
 Removing the unreachable productions.
 Removing the ambiguity from the Grammar.
 Removing the left recursion.
 Left Factoring of a grammar.
 First and Follow
 Constructing a parse table
Removing Unreachable Productions
Algorithm of Removing Unreachable Productions
Data Structures required
 A stack
 A List for Reachable Variables
Method:
Primarily both the stack and list are Empty.
Step 1:
Start symbol to the list of reachable Variables also push onto the stack.
Step 2:
While (The stack is not Empty)
{
P= POP one Item of the stack
for (Each Variables X on right hand side are P)
{
If (X is not in the list of reachable Variables)
{
Push X;
Add X to the list of Reachable Variables;
}
}
}
Step 3:
Remove all the productions Â from theÂ grammar where LHS is not in the list ofÂ reachable Variables.
with unreachable productions 
after elimination ofunreachable productions 
S> aX
X>b Y>c 
S> aX
X>b

Note: Y and Y>c will be ignored because Y can’t be reached with S or X.
CFG Production Rules with unreachable productions
S> aY  bX
X>a  bXX  aS
Y> b  aYY  bS
C> aD  bS Â â‚¬
D> bD Â â‚¬
CFG Production Rules with reachable productions
After Removing Unreachable Productions we have the following CFG.
S> aY  bX
X> a  bXX  aS
Y> b  aYY  bS
More examples of Removing unreachable productions
Eliminating Ambiguity from Grammar
A CFG is an ambiguous CFG if it has more than one derivation tree for the given input string i.e., more than one RightMostÂ DerivationÂ Tree or more than one LeftMostÂ DerivationÂ Tree.
Example 1:
For example, we have a CFG.
SÂ â†’XYÂ Â mmY
XÂ â†’mÂ Â Xm
YÂ â†’n
Determine whether the grammar G is ambiguous or not?
Let us derive the string “mmn”
The given CFG is ambiguous. The unambiguous CFG is given below;
Unambiguous grammar will be:
SÂ â†’XY
XÂ â†’XmÂ Â m
YÂ â†’n
Ambiguous CFG  Unambiguous CFG 
SÂ â†’XYÂ Â mmY
XÂ â†’mÂ Â Xm YÂ â†’n 
SÂ â†’XY
XÂ â†’XmÂ Â m YÂ â†’n 
Example of Elimination of Left Recursion from a CFG
Left recursion is eliminated by converting the CFG into a right recursive CFG.
Example of Left Recursive Grammar
CFG = X â†’ XÎ± / Î²
where Î² does not begin with an A.
After Elimination of Left Recursion from CFG.
Then, we can eliminate left recursion by replacing the pair of productions with
X â†’Â Î²Xâ€™
Xâ€™ â†’Â Î±Xâ€™ / âˆˆ
Now the CFG is Right Recursive CFG
NoteÂ This right recursive grammar functions the same as left recursive grammar.
Example of removal of Left Recursion from a Grammar
X â†’ XYd / Xa / a
Y â†’ Ye / b
After Elimination of Left Recursion from CFG.
The CFGafter eliminating left recursion is given below;
Xâ†’ aXâ€™
Xâ€™ â†’ YdXâ€™ / aXâ€™ /Â âˆˆ
Y â†’ bYâ€™
Yâ€™ â†’ eYâ€™ /Â âˆˆ