50 50 votes Consider the grammar shown below. $S \rightarrow C \ C$ $C \rightarrow c \ C \mid d$ This grammar is LL(1) SLR(1) but not LL(1) LALR(1) but not SLR(1) LR(I) but not LALR(1) Compiler Design gatecse-2003 compiler-design grammar parsing normal + – Kathleen 29.7k views answer comment Share Follow Print See all 4 Comments 4 4 Comments reply js__ commented Nov 2, 2025 i edited by js__ Nov 8, 2025 reply Follow flag If a grammar is LL(1), then it is also usually LR(1), SLR(1), and LALR(1) —but not necessarily LR(0).LR(0)⊂SLR(1)⊂LALR(1)⊂LR(1) 1 1 replyShare Eevee commented Nov 7, 2025 reply Follow flag If a grammar is LL(1), then it is also LR(1), SLR(1), and LALR(1) @jeets That is incorrect. If grammar is LL(1) then it will be LR(1). We cannot comment on LR(0), SLR(1) or LALR(1) 3 3 replyShare js__ commented Nov 8, 2025 reply Follow flag @yoda https://chatgpt.com/s/t_690ea612b77081919770c3e85b1c157d 1 1 replyShare Tushar Rana commented Nov 10, 2025 reply Follow flag @jeets @yoda jeet, Yoda is correct if only language is ll(0) then it is LR(0), SLR(1), LALR(1), and so on. 4 4 replyShare Please log in or register to add a comment.
Best answer 100 100 votes 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. Pooja Palod answered Aug 5, 2015 • edited Dec 7, 2017 by kenzou Pooja Palod comment Share Follow See all 33 Comments 33 33 Comments reply Show 30 previous comments ankit3009 commented Nov 9, 2021 reply Follow flag Can we say say like this? If say we are able to develop a DFA for given grammar then it’s for sure that it’s LL(k). If say we are able to develop a DPDA for given grammar then it’s for sure that it’s LR(k). 0 0 replyShare Franz Kafka commented Nov 16, 2024 reply Follow flag What about LR(0) grammar ? 0 0 replyShare Ekalavyaa commented Dec 30, 2025 reply Follow flag @pranavbhosle_Yes it is LR(0) 0 0 replyShare Please log in or register to add a comment.
7 7 votes Answer is A OO7 answered Jul 7, 2018 OO7 comment Share Follow See all 2 Comments 2 2 Comments reply Aayush Tripathi commented Jan 18, 2020 reply Follow flag 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". 0 0 replyShare indra kumar sahu commented Aug 23, 2020 reply Follow flag how from S you derived d in LL(1) table S->CC and C is not containing epsilon 0 0 replyShare Please log in or register to add a comment.
3 3 votes Ambiguous? I think nope. Left Recursive? No. Non-deterministic? No. For any $A\rightarrow \alpha \beta$ do the Firsts of $\alpha$ and $\beta$ clash? No. So, this is LL(1). Does it have $\epsilon$? No. Hence, this is SLR(1) and everything above it. Option A JashanArora answered Dec 21, 2019 JashanArora comment Share Follow 0 reply Please log in or register to add a comment.