-
The grammar S → aSa | bS| c is
-
- LL (1) but not LR (1)
- LR (1) but not LL (1)
- Both LL (1) and LR (1)
- Neither LL (1) and LR (1)
- LL (1) but not LR (1)
Correct Option: C
S → aSa | bS | C
The above grammar is LL (1) because,
First [aSa] ∩ first [bS] = (a) ∩ (b) = φ
First [bS] ∩ first [c] = (b) ∩ (c) = φ
First [c] ∩ first [aSa] = (c) ∩ (a) = φ
As the above grammar is LL (1), also LR (1) because LL (1) grammar is always LR (1) grammar.