Left factorization


Left factorization is the rewriting of a formal grammar to eliminate productions starting with the same token.

Left factorization is one of the necessary conditions for a deterministic top-down analysis. Exemplify the code

Let the following non-deterministic grammar:       S → S a | b

The left factorization of this one is as follows:       S → b       S'→ S '| e

Then we get a deterministic grammar. code Related Articleschange the code

wiki