The Gateway to Computer Science Excellence
+1 vote
115 views

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 Loyal (6.9k points) | 115 views
0
Please Explain Every point :)
0

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:-  https://gateoverflow.in/33619/which-type-of-compiler-conflict-is-detected-and-resolving-it

0
For SR Conflict i got , explain for RR Conflcit , any reference for rr conflict
0
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 )
0
0

Refer : https://gateoverflow.in/1405/gate2005-83a

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

Here : https://gateoverflow.in/87037/gate2005-83b

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
50,647 questions
56,497 answers
195,489 comments
100,811 users