1 1 vote 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 3.1k views answer comment Share Follow Print See all 16 Comments 16 16 Comments reply Vikas123 commented Jan 13, 2019 i moved by Mk Utkarsh Jan 21, 2019 reply Follow flag C....?? 0 0 replyShare Magma commented Jan 13, 2019 reply Follow flag I got C 0 0 replyShare Na462 commented Jan 14, 2019 reply Follow flag 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 1 replyShare Mk Utkarsh commented Jan 21, 2019 reply Follow flag ...... 0 0 replyShare Na462 commented Jan 21, 2019 reply Follow flag 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 1 replyShare Mk Utkarsh commented Jan 21, 2019 reply Follow flag 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 1 replyShare Na462 commented Jan 21, 2019 reply Follow flag :o i didn't knew that Brother can you please elaborate the difference I didnt get that properly what u are conveying :) 0 0 replyShare Mk Utkarsh commented Jan 21, 2019 reply Follow flag I solved this question https://www.youtube.com/watch?v=_IjnuD07fEI check here 0 0 replyShare Na462 commented Jan 21, 2019 reply Follow flag Brother had it been a top down parser what would have been the result ? 0 0 replyShare Na462 commented Jan 21, 2019 reply Follow flag 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 0 replyShare Mk Utkarsh commented Jan 21, 2019 reply Follow flag Na462 i think so never thought about it @Shaik Masthan what are your views? 0 0 replyShare Na462 commented Jan 21, 2019 reply Follow flag 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 0 replyShare Mk Utkarsh commented Jan 21, 2019 reply Follow flag Na462 had it be top down or bottom up, print when you encounter any semantic action 1 1 replyShare kirtipurohit commented Feb 26, 2021 reply Follow flag Its private . Can you please make available? @Mk Utkarsh 0 0 replyShare Hradesh patel commented Feb 26, 2021 reply Follow flag I think Option C is correct according to TOP DOWN parser. Is it BPBPBPBC in BOTTOM UP parser?? Please check and explain Thanks. 0 0 replyShare Soumik Roy commented Aug 22, 2024 reply Follow flag should be a top-down parser, not bottom-up bottom-up answer - BPBPBPBC and top-down's answer - CBPBPBPB ( option - c ) 0 0 replyShare Please log in or register to add a comment.
1 1 vote 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 1 1 comment reply reboot commented Aug 30, 2020 reply Follow flag Option ‘C’ is definitely correct. And yes, here even top-down will produce the same answer. 0 0 replyShare Please log in or register to add a comment.