retagged by
667 views
2 votes
2 votes

Consider the following grammar:
$S \rightarrow  L = P \mid P$
$L \rightarrow ^*P \mid id$
$P \rightarrow L$

The above grammar is:

  1. Ambiguous
  2. SLR(1)
  3. LALR(1)
  4. None of the above
retagged by

2 Answers

Best answer
2 votes
2 votes

 there are no conflicts in any states and merging based on lookaheads is also possible. it is LALR(1) grammar.

selected by
1 votes
1 votes
Can someone explain me how this is checked?
Answer:

Related questions

3 votes
3 votes
1 answer
1
Bikram asked Nov 25, 2016
266 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
2
Bikram asked Nov 25, 2016
500 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
3
Bikram asked Nov 25, 2016
449 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...