1 votes 1 votes How to solve this ? Please help. Compiler Design compiler-design grammar context-free-grammar ll-parser descriptive made-easy-test-series + – raja11sep asked Dec 31, 2021 • retagged Jun 20, 2022 by Lakshman Bhaiya raja11sep 656 views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply raja11sep commented Dec 31, 2021 reply Follow Share These are option A and B. 0 votes 0 votes raja11sep commented Dec 31, 2021 reply Follow Share Option C and D. 0 votes 0 votes Please log in or register to add a comment.
2 votes 2 votes For approaching such questions one must be clear about how LR(1) parsers actually work. I am inserting image of stack content after reading each input symbol left to right one by one. Hope it helps Isha_99 answered Dec 31, 2021 Isha_99 comment Share Follow See all 3 Comments See all 3 3 Comments reply Isha_99 commented Dec 31, 2021 reply Follow Share Inserting next image in the comment section. 1 votes 1 votes raja11sep commented Dec 31, 2021 reply Follow Share Thanks for the ans...But your stack content is wrong..5th stack contains a,T,b,c from bottom to top. Which is invalid ,after b you can not puch c ..here ‘b’ is a handle so viable prefix (Stack contains at any time) can not exist beyond ‘b’ , pop ‘b’ and push ‘T’. 0 votes 0 votes Isha_99 commented Dec 31, 2021 reply Follow Share @raja11sep My stack content is right , c will be there after b as this is what LR(1) does .Instead of blindly reducing b into T it will check lookahead of b i.e. c . Is c follow of my stack content after reduction of b into T or not ? 1 votes 1 votes Please log in or register to add a comment.