I think the left-recursion for this grammar is not removable. Correct me if I am wrong. α is Alpha that is a Non-terminal ε is Epsilon.
Asked
Active
Viewed 77 times
-1

HamzaFarooq
- 429
- 1
- 4
- 16
-
3Not sure if this is off-topic for this site or not, but you can just swap `A -> αA | ε`. Both rule definitions will be equivalent to the regular expresion `α*`, that is, a sequence of as many alpha characters you wish (including none). – Mephy Jun 09 '20 at 16:08
1 Answers
1
Left recursion can be removed from the grammar; Here is the grammar without left recursion:
A -> A' | ε
A' -> α A
You could also do how @Mephy did with right recursion:
A -> α A | ε
Note that (as @Mephy said) this grammar is just zero or more α
s (α*
).

xilpex
- 3,097
- 2
- 14
- 45