Description: Elimination of left factoring in the given grammar
For each nonterminal A find the longest prefix (alpha) common to two or more of its alternatives.If alpha is not equal epsilon,i.e..,there is a nontrivial common prefix,replace all the A productions
Aàalpha beta1|alpha beta2|…|alpha betan|gamma
where gamma
represents all alternatives that donot begin with alpha by
AàalphaA’|gamma
A’àbeta1|beta2|…..|betan
Here A’ is the new terminal..
Repeatedly apply this transformation until no two alternatives for a nonterminal have a common prefix.
File list (Check if you may need any files):
parser.docx