1 votes 1 votes Consider the following Translation rules for the Grammar G : What will be the output for input string abebebe for bottom up parser ? CBBPBPBP CBBBPPBB CBPBPBPB CBPBBPPB Compiler Design compiler-design syntax-directed-translation made-easy-test-series + – Na462 asked Jan 13, 2019 edited Mar 4, 2019 by ajaysoni1924 Na462 1.2k views answer comment Share Follow See all 15 Comments See all 15 15 Comments reply Vikas123 commented Jan 13, 2019 i moved by Mk Utkarsh Jan 21, 2019 reply Follow Share C....?? 0 votes 0 votes Magma commented Jan 13, 2019 reply Follow Share I got C 0 votes 0 votes Na462 commented Jan 14, 2019 reply Follow Share My doubt is in bottom up parser the print statement should be executed when reduction is performed so according to that no option matches Instead C was the only option I got . 1 votes 1 votes Mk Utkarsh commented Jan 21, 2019 reply Follow Share ...... 0 votes 0 votes Na462 commented Jan 21, 2019 reply Follow Share But brother according to me in bottom up parser the print statement is executed i.e. the semantic action when the reduction will perform na So the answer should be the reverse of what is printed ? Why u did what u did brother ? 1 votes 1 votes Mk Utkarsh commented Jan 21, 2019 reply Follow Share Na462 yes it is bottom up and mostly semantic actions are placed are rightmost end like this $S \rightarrow$ a A {print a} that's why a is printed while we move up but in this specific question the semantic action is in the middle of productions and non-terminals are right end so while going down we will do all semantic actions except the last one A $\rightarrow \epsilon$ because semantic action is on rightmost end 1 votes 1 votes Na462 commented Jan 21, 2019 reply Follow Share :o i didn't knew that Brother can you please elaborate the difference I didnt get that properly what u are conveying :) 0 votes 0 votes Mk Utkarsh commented Jan 21, 2019 reply Follow Share I solved this question https://www.youtube.com/watch?v=_IjnuD07fEI check here 0 votes 0 votes Na462 commented Jan 21, 2019 reply Follow Share Brother had it been a top down parser what would have been the result ? 0 votes 0 votes Na462 commented Jan 21, 2019 reply Follow Share Actually my doubt is you're simply executing the print statement when you encounter one, i do that in case of top down so does it mean here in this case the output will be same as the one for top down ? 0 votes 0 votes Mk Utkarsh commented Jan 21, 2019 reply Follow Share Na462 i think so never thought about it @Shaik Masthan what are your views? 0 votes 0 votes Na462 commented Jan 21, 2019 reply Follow Share Now the way i think in bottom up the print statement is at the last so the first print which i will encounter will eventually be last so there also i am using the same funda right ? i.e. to execute a print statement the moment i encounter one 0 votes 0 votes Mk Utkarsh commented Jan 21, 2019 reply Follow Share Na462 had it be top down or bottom up, print when you encounter any semantic action 1 votes 1 votes kirtipurohit commented Feb 26, 2021 reply Follow Share Its private . Can you please make available? @Mk Utkarsh 0 votes 0 votes Hradesh patel commented Feb 26, 2021 reply Follow Share I think Option C is correct according to TOP DOWN parser. Is it BPBPBPBC in BOTTOM UP parser?? Please check and explain Thanks. 0 votes 0 votes Please log in or register to add a comment.
1 votes 1 votes None ...no option are matching ...either question should mention ...top down parser Anup dogrial answered Jan 16, 2020 Anup dogrial comment Share Follow See 1 comment See all 1 1 comment reply reboot commented Aug 30, 2020 reply Follow Share Option ‘C’ is definitely correct. And yes, here even top-down will produce the same answer. 0 votes 0 votes Please log in or register to add a comment.