Consider the following grammar:
S → bAb
| bBa
A → aS
| CB
B → b
| Bc
C → c
| cC
I have to provide the reasons as to why this grammar is not LL(1). So far all I can think of is that the grammar is not left factored given the productions:
S → bAb
| bBa
But I am also wondering if the grammar is left recursive due to the productions:
B → b
| Bc
Options provided are:
- This grammar has left recursion. (Unsure)
- This grammar has right recursion. (Would not make grammar not LL(1))
- This grammar is ambiguous. (Unsure)
- This grammar is not left factored. (Correct)
- This grammar can produce infinitely many distinct strings. (This shouldn't affect a grammar right?)
As far as I can tell, the grammar is not ambiguous, I have tried 3 different inputs and all have resulted in a single parse tree. So is this grammar not LL(1) just because of the lack of left factoring? or also because the grammar is left recursive?