Is this true Arjun sir?

The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+25 votes

Consider the grammar shown below.

$S \rightarrow C \ C$

$C \rightarrow c \ C \ | \ d$

This grammar is

- LL(1)
- SLR(1) but not LL(1)
- LALR(1) but not SLR(1)
- LR(I) but not LALR(1)

+38 votes

Best answer

ans is **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 \rightarrow 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 $\epsilon$ free LL(1) grammar is also SLR(1) and hence LALR(1) and LR(1) too.

0

wikki says-

A *ε*-free LL(1) grammar is also a SLR(1) grammar. A LL(1) grammar with symbols that have both empty and non-empty derivations is also a LALR(1) grammar. A LL(1) grammar with symbols that have only the empty derivation may or may not be LALR(1).^{[5]}

0

According to wiki - https://en.wikipedia.org/wiki/LL_grammar

A LL(1) grammar with symbols that have both empty and non-empty derivations is also a LALR(1) grammar.

is it true?

0

@Arjun sir @Pooja Palod mam.. please validate these statement

"A LL(1) grammar with symbols that have both empty and non-empty derivations is also a LALR(1) grammar."

"An ϵ free LL(1) grammar is also SLR(1) and hence LALR(1) and LR(1) too."

- All categories
- General Aptitude 1.5k
- Engineering Mathematics 7.1k
- Digital Logic 2.7k
- Programming & DS 4.9k
- Algorithms 4.2k
- Theory of Computation 5.3k
- Compiler Design 2.1k
- Databases 4k
- CO & Architecture 3.5k
- Computer Networks 4k
- Non GATE 1.4k
- Others 1.5k
- Admissions 559
- Exam Queries 555
- Tier 1 Placement Questions 23
- Job Queries 69
- Projects 18

47,932 questions

52,335 answers

182,384 comments

67,817 users