3,480 views
3 votes
3 votes
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)

1 Answer

4 votes
4 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.

edited by
Answer:

Related questions

6 votes
6 votes
2 answers
1
Arjun asked Jan 26, 2019
1,732 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...
4 votes
4 votes
2 answers
2
Arjun asked Jan 26, 2019
872 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 po...