2,307 views
2 votes
2 votes

GATE 2010 Question

The grammar S→aSa∣bS∣c is 

  1. LL(1) but not LR(1)
  2. LR(1) but not LL(1)
  3. Both LL(1) and LR(1)
  4. Neither LL(1) nor LR(1)

I have 2 small doubt

First Doubt:-If a grammer is LL(1) then it is always LR(0) ? Is there any grammer which is LL(1)  and cannot be parsed by LR(0) ?

Second doubt :- Can any one tell me the above question is write or wrong because they have given LR(1) parser and i haven't heard about LR(1).I have heard about  Brute force ,recursive descent,operator presedence,LL(1) LR(0) SLR(1) LALR(1) CLR(1).So what is the difference between LR(0) AND LR(1) and which one is more powerfull ?

3 Answers

Best answer
8 votes
8 votes

First Doubt : A grammar parsed by LL(1) must also be parsed by LR(1) Parser but may not by LR(0)

For e.g 

S. ---> AaAb 

S ---> BbBa

A ---> €

B ---> €

Second doubt : LR(1) also known as canonical LR(1)

So LR(1) and CLR(1) same.

selected by

Related questions

6 votes
6 votes
2 answers
1
Arjun asked Jan 26, 2019
1,687 views
If we merge states in LR(1) parser to form a LALR(1) parser, we may introduceshift-reduce conflictreduce-reduce conflictno extra conflictboth shift-reduce as well as redu...
0 votes
0 votes
1 answer
2
Utsav09 asked Jan 31, 2018
352 views
Consider the grammar given$S\rightarrow AA$$A\rightarrow aA / b$How many entries will be blank in the GOTO table for SR(0) items?
1 votes
1 votes
2 answers
3
LavTheRawkstar asked Jun 27, 2016
6,724 views
Consider the following grammarE → E+T/TT → T*F/FF → id/(E)Calculate Lead and Last for every Non terminal.
0 votes
0 votes
1 answer
4