3 votes 3 votes Consider the following grammar: S-->XX X-->b X-->aX Which of the following can be the viable prefixes? baab aab aaabab bbbaX Compiler Design compiler-design viable-prefix parsing made-easy-test-series + – Sambhrant Maurya asked Jan 11, 2019 edited Mar 4, 2019 by ajaysoni1924 Sambhrant Maurya 2.4k views answer comment Share Follow See all 4 Comments See all 4 4 Comments reply Mk Utkarsh commented Jan 11, 2019 reply Follow Share B? 0 votes 0 votes Sambhrant Maurya commented Jan 11, 2019 reply Follow Share Yes. How? I know how to recognize viable prefixes when a string to be parsed is given, but here no string is given?? 0 votes 0 votes Mk Utkarsh commented Jan 11, 2019 reply Follow Share 1. baab b will be pushed and before pushing next letter b will be reduced to X, so baab as viable prefix is not possible with similar reason 3 and 4 are not viable prefixes, but aab is .aab a.ab (a is pushed,no handle found) aa.b (a is pushed and viable prefix is aa still no handle found) aab. (b is pushed and handle found and will be reduced in next step but aab is a valid viable prefix) For practice you can refer this one 3 votes 3 votes Abhinav Gupta commented Jan 11, 2019 reply Follow Share https://gatecse.in/viable-prefixes-and-handle-in-lr-parsing/ check this link. 1 votes 1 votes Please log in or register to add a comment.
0 votes 0 votes Viable prefix is nothing but stack content in LR Parsing ....in this ques check option if it is visible is stack while doing parsing .. that's it...B Anup dogrial answered Jan 6, 2020 Anup dogrial comment Share Follow See all 3 Comments See all 3 3 Comments reply kashyap02 commented Jan 15, 2020 reply Follow Share This method of your is good but checking four option with complete parsing method will take a lot of time, don't you have any less time taking method? 0 votes 0 votes Antaroop commented Jan 20, 2020 i edited by Antaroop Jan 20, 2020 reply Follow Share Why can't C be the answer? By following MK Utkarsh sir's method for option C - .aaabab a.aabab aa.abab aaa.bab aaab.ab [ b is reducible to X] aaaX.ab [ aX is reducible to X] aaX.ab [ aX is reducible to X] aX.ab [ aX is reducible to X] X.ab Xa.b Xab. [ b is reducible to X] XaX. [ aX is reducible to X] XX. [ XX is reducible to S] S Where am I going wrong ? Can someone please point out ? @ Mk Utkarsh sir, @ Anup dogrial sir. 0 votes 0 votes mohan123 commented Sep 21, 2020 reply Follow Share yes c is wrong why viable prefixes which is collection of symbol on top of the stack which prefixes is not replaced by any production of the cfg. when b is reduce that time prefix will be { a,aa,, aaa, aaab } refer this example your double we'll be more clear https://gatecse.in/viable-prefixes-and-handle-in-lr-parsing/ 0 votes 0 votes Please log in or register to add a comment.