Consider the grammar shown below.
This grammar is
ans is A $First(S)=First(C)=\{c,d\}$ There are no multiple entries in single row of parsing table hence grammar is LL1 Note : If we have $A \rightarrow B\mid 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 $\epsilon$ free LL(1) grammar is also SLR(1) and hence LALR(1) and LR(1) too.
check out the here for the explanation of
“An ϵ free LL(1) grammar is also SLR(1) and hence LALR(1) and LR(1) too”.
https://gateoverflow.in/144246/ll-1-and-lalr-1
And please correct me if anything is wrong there.
Can we say say like this?
Answer is A
Hi @Sachin Mittal 1, is this statement really true "every DCFL has an LR(1), an LALR(1) and even an SLR(1) grammar". Check this wiki link out https://en.wikipedia.org/wiki/LALR_parser, it says here "It was also proven that there exist LR(1) languages that are not LALR".
Ambiguous?
I think nope.
Left Recursive?
No.
Non-deterministic?
For any $A\rightarrow \alpha \beta$ do the Firsts of $\alpha$ and $\beta$ clash?
So, this is LL(1).
Does it have $\epsilon$?
Hence, this is SLR(1) and everything above it.
Option A
64.3k questions
77.9k answers
243k comments
79.7k users