The Gateway to Computer Science Excellence
+1 vote

Which one of the following is true about LALR(1) Parser ?

  1. It can resolve SR Conflict in favor of reduced
  2. It can resolve SR Conflict in favor of Shift
  3. It can resolve RR Conflict in favor of reduced
  4. It can resolve RR Conflict in favor of shift
in Compiler Design by | 214 views
Please Explain Every point :)

In LALR(1) parser(same as Yacc) 

For S/R conflict it resolves in favour of shift.

For R/R conflict it resloves in favour of any reduce from both.

Option b) is correct.

One more option possible => Depends on the situation of conflict (If this is there it is most appropriate.

For more details follow link:-

For SR Conflict i got , explain for RR Conflcit , any reference for rr conflict
I am not finding reference right now but I am 100% sure

In RR conflict it can be resolved in favour of any of the reduce not for a particular reduce thatwise c) is not answer.

In c) they are saying RR conflicts in favour of reduce( not mentioning that which reduce )

Refer :

In case of RR Conflict we reduce using the first production that comes textually in the grammar.

Here :

Thats why when we have :   E x  E +  E   -----(RR Conflict and E+E comes first HENCE) ==> (E X (E + E)) SO answer is 9 

Correct me if i am wrong :)

Please log in or register to answer this question.

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
52,345 questions
60,503 answers
95,331 users