-
Consider the grammar shonws below :
S → CC
C → cc/ d
This grammar is
-
- LL (1)
- SLR (1) but not LL (1)
- LALR (1) but not SLR (1)
- LR (1) but not LALR (1)
- LL (1)
Correct Option: A
First (S) = First (C) = {c,d} there are no multiple in single row of parsing table hence grammar is LL1
Note : if we have A → B/C for grammar to be LL(1) first(B) intersection First(C) should be null otherwise grammar is not LL1. If First(B) contains epsilon then Follow(A) intersection First(C) should be null. Using this we can say grammar is LL(1) or not without constructing parsing table.
An ∈ ∈ free LL(1) grammar is also SLR(1) and hence LALR(1) and LR(1) too.
Since there is no conflict, the grammar is LL(1). We can construct a predictive parse table with no conflicts. This grammar also LR(0), SLR(1), CLR(1) and LALR(1).