Left factoring is a grammar tranformation technique.
Good Read: http://www.csd.uwo.ca/~moreno/CS447/Lectures/Syntax.html/node9.html
Left Factoring is a grammar transformation technique. It consists in "factoring out" prefixes which are common to two or more productions.
For example, going from:
A -> α β | α γ
to:
A -> α A' A' -> β | γ
A -> α A'
A' -> β | γ
What is nondeterminism in grammar?
Also called common suffix problem. There is non-determinism in grammar when in the same production there is more than one option to proceed further on reading a particular symbol.
A → α β | α γ
The compiler will be confused whether to take use first production or 2nd one.So it tires both one after the other which may lead to backtracking.
What is left factoring?
A → α A' A' → β | γ
A → α A'
A' → β | γ
Good Read: https://cs.stackexchange.com/questions/4862/left-factoring-a-grammar-into-ll1
Source: https://stackoverflow.com/questions/15194142/difference-between-left-factoring-and-left-recursion?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
64.3k questions
77.9k answers
244k comments
80.0k users