Left recursion elimination
Examined at 8 marks, and the exam’s own expression grammar is the opening preset. Immediate recursion A → Aα | β becomes A → βA′ with A′ → αA′ | ε; indirect recursion is handled by substituting earlier variables out first, one variable per step.
Presets:
3 variables {E, T, F}, 5 terminals {+, *, (, ), id}, start E — 6 productions.
The order trap
Left recursion elimination introduces ε-productions — every new primed variable gets one. The grammar-simplification pipeline (arriving with Module 4's tools) removes ε-productions, and the two transformations are taught in different modules, so it is easy to run them in the wrong order: ε-removal first would hand this algorithm input it refuses. Eliminate left recursion first, clean up ε afterwards.