search
Log In
2 votes
1.2k views
Which of the following statements is FALSE?
  1. In a SLR(1) parser, it is allowable for both shift and reduce items to be in the same state
  2. In a SLR(1) parser, it is allowable for multiple reduce items to be in the same state
  3. All SLR(1) grammars are LR(0)
  4. All LR(0) grammars are SLR(1)
in Compiler Design 1.2k views
0
C.

LR(0) < SLR(1) < LALR(1) < LR(1)

LL(1) < LR(1) and LL(0) < LR(0)

LL(k) < LR(k)
0
Is this question is for TRUE statement?

1 Answer

3 votes
  1. In a SLR(1) parser, it is allowable for both shift and reduce items to be in the same state 

                     even though it leads to sr conflict but it is allow

        2.In a SLR(1) parser, it is allowable for multiple reduce items to be in the same state 

                     even though it leads to sr conflict but it is allow

       3. All SLR(1) grammars are LR(0) 

                  this statement is wrong.Reason is

                  LR(0)<SLR(1)<LALR(1)<CLR(1)

                   --> if a grammar is LR(0) then it is also SLR(1),LALR(1),CLR(1).

                   --> if a grammar is SLR(1) then it is also LALR(1),CLR(1).

                   --> if a grammar is LALR(1) then it is also CLR(1).

        4.All LR(0) grammars are SLR(1)

Therefore C is Correct.

0
How SLR(1) parser will allow both shift and reduce/reduce and reduce items to be in the same state?
0
On option A and B is true because of lookahead symbol ???

Plz explain why Option A and B is true
2
In SLR(1) table we place the reduce moves  in FOLLOW(LHS of the production).

So if we have , $A \rightarrow \alpha. $ and $B \rightarrow \beta. $ in same state then if $FOLLOW(A) \cap FOLLOW(B) = \phi$ then there will be no R-R conflict in SLR(1) since these reduce moves will be placed n different cells.

similarly,

if we have , $A \rightarrow \alpha . C $ and $B \rightarrow \beta. $ in same state then if $FOLLOW(B) \neq \ cell \ at \ which \ shift \ move \ will \ be \ placed $ then there will be no conflict in SLR(1)
Answer:

Related questions

4 votes
2 answers
1
392 views
If we merge states in LR(1) parser to form a LALR(1) parser, we may introduce shift-reduce conflict reduce-reduce conflict no extra conflict both shift-reduce as well as reduce-reduce
asked Jan 26, 2019 in Compiler Design Arjun 392 views
0 votes
2 answers
2
285 views
Suppose we have a rightmost derivation which proceeds as follows: $\begin{array}{ccc}S &\rightarrow & Aabw \\ & \rightarrow &ABw \end{array}$ Which of the following is a possible handle for it? $\begin{array}{ccc} A &\rightarrow & ab \end{array}$ ... $\begin{array}{ccc} S &\rightarrow & A \end{array}$ $\begin{array}{ccc} B &\rightarrow & ab \end{array}$
asked Jan 26, 2019 in Compiler Design Arjun 285 views
4 votes
2 answers
3
1.1k views
Which of the following statements is FALSE? Any DCFL has an equivalent grammar that can be parsed by a SLR(1) parser with end string delimiter Languages of grammars parsed by LR(2) parsers is a strict super set of the languages of grammars parsed by LR(1) parsers Languages of ... of grammars parsed by LL(1) parsers There is no DCFL which is not having a grammar that can be parsed by a LR(1) parser
asked Jan 26, 2019 in Compiler Design Arjun 1.1k views
2 votes
2 answers
4
521 views
Which of the following statements regarding $LR(0)$ parser is FALSE? A $LR(0)$ configurating set cannot have multiple reduce items A $LR(0)$ configurating set cannot have both shift as well as reduce items If a reduce item is present in a $LR(0)$ configurating set it cannot have any other item A $LR(0)$ parser can parse any regular grammar
asked Jan 26, 2019 in Compiler Design Arjun 521 views
...