1 votes 1 votes $A→ b.a , \left \{ b \right \}$ $B→ b.,\left \{ a \right \}$ It is a SR conflict in LALR(1). Now how reduce state operated on $a$ for non terminal $B$(and not $b$) ? Compiler Design parsing compiler-design + – srestha asked Jun 17, 2018 srestha 1.4k views answer comment Share Follow See all 4 Comments See all 4 4 Comments reply srestha commented Jun 17, 2018 reply Follow Share S -> .AB ($) A -> .aAb (d) A -> .a (d) here too how lookahead for A is d?? got from this link https://stackoverflow.com/questions/14103199/lr1-item-dfa-computing-lookaheads 0 votes 0 votes Shubhgupta commented Jun 17, 2018 reply Follow Share S -> .AB ($) because S is start symbol and lookahead of start symbol is $. after that we'll get all production of A. A-> .aAb, (d) because FIRST(B) is d. we decide lookahead on the basis of FIRST of next symbol(S-> .AB here all production of A will have the lookahead of FIRST(B)). 0 votes 0 votes srestha commented Jun 17, 2018 reply Follow Share how lookahead is calculated? follow of A or first of B? 0 votes 0 votes Shubhgupta commented Jun 17, 2018 reply Follow Share by FIRST of B. 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes This productions are not from a LR (1) grammar. If after merging the states of LR(1) grammar we end up with shift reduce conflict then be sure that the grammar we have used was not LR(1). We can only have reduce reduce conflict in LALR(1) which we form by merging states of LR(1) grammar target2020 answered Sep 26, 2020 target2020 comment Share Follow See all 0 reply Please log in or register to add a comment.