Next: Parsing
Up: Context-free grammars
Previous: Elimination of left recursion
Left factoring is another useful grammar transformation used in parsing.
The general ideal is to replace the productions
where
- A, A' are nonterminals,
-
,,...,
are strings of symbols with
,
- represents all alternatives for A-productions that do not start with .
Example 13
Let us consider the following grammar:
By left factoring we obtain
Next: Parsing
Up: Context-free grammars
Previous: Elimination of left recursion
Marc Moreno Maza
2004-12-02