in Compiler Design retagged by
559 views
2 votes
2 votes

Read the following grammar:

$S \rightarrow  Ka \mid bKc \mid dc  \mid bda$
$K \rightarrow  d$

This grammar is NOT:

  1. LALR(1)
  2. SLR(1)
  3. LR(1)
  4. None of the above
in Compiler Design retagged by
by
559 views

3 Comments

How option (b) is correct??
0
0
2
2
ok..thanx.
0
0

2 Answers

3 votes
3 votes

Follow of $K$ contains $c$, hence it is not $SLR(1)$.

1 comment

  • The production $S\rightarrow d.c,K\rightarrow d.$ has SR conflict, because $follow(K)=a,c\in c$ is in shift move.
  • The  has production $S\rightarrow bd.a,K\rightarrow d.$ also  has SR conflict. 

$\therefore$ given grammar is not SLR(1).

0
0
1 vote
1 vote

$[Closure]$ on $d$ would have $K\rightarrow d.$ and $S\rightarrow d.c$

So, there's one final item (reduce move/handle) and one shift move possible on c.

=> SR conflict for LR(0)

 

Check $Follow(K)$. It has c.

=> SR conflict for SLR(1), too.

 

Option B

Answer:

Related questions