retagged by
567 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
retagged by

2 Answers

3 votes
3 votes

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

1 votes
1 votes

$[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

2 votes
2 votes
2 answers
1
Bikram asked Nov 25, 2016
694 views
Consider the following grammar:$S \rightarrow L = P \mid P$$L \rightarrow ^*P \mid id$$P \rightarrow L$The above grammar is:AmbiguousSLR(1)LALR(1)None of the above
3 votes
3 votes
1 answer
2
Bikram asked Nov 25, 2016
283 views
Which grammar causes recursive-descent parser to go into infinite loop?LL(1)Left recursive grammarRight recursive grammarGrammar with left factors
3 votes
3 votes
2 answers
3
Bikram asked Nov 25, 2016
520 views
Consider the following grammar:$S \rightarrow aMd \mid bNd \mid aNe \mid bMe$$M \rightarrow c$$N \rightarrow c$The grammar above is:LR(1) but not LALR(1)LALR(1) but no...
3 votes
3 votes
1 answer
4
Bikram asked Nov 25, 2016
474 views
Consider the following grammar:$E \rightarrow E + T \mid T$$T \rightarrow T ^* F \mid F$$F \rightarrow (E) \mid id$What are the productions for E, T and F after convertin...