2 votes 2 votes If a grammer(CFG) is ambiguous then we can construct the topdown and bottomup parsing is possible directly???or we will make them into unambiguous then we will construct??? Compiler Design compiler-design context-free-grammar ambiguous-grammar + – Prakash059 asked May 3, 2016 • retagged Jun 20, 2022 by Lakshman Bhaiya Prakash059 2.0k views answer comment Share Follow See 1 comment See all 1 1 comment reply arks commented Jan 3, 2023 reply Follow Share Check out this article : https://www.geeksforgeeks.org/parsing-ambiguos-grammars-using-lr-parser/ 0 votes 0 votes Please log in or register to add a comment.
Best answer 4 votes 4 votes No parser can parse the ambiguous grammar .So first convert them unambiguous grammar.Then check whether they are parsable or not by the specific parser. PS:Only Operator precedence parser can work with ambiguous Grammar ! ManojK answered May 3, 2016 • edited May 3, 2016 by ManojK ManojK comment Share Follow See all 4 Comments See all 4 4 Comments reply Prakash059 commented May 3, 2016 reply Follow Share Thank u bro 1 votes 1 votes Dexter commented May 3, 2016 reply Follow Share Only Operator precedence parser can work with ambigious Grammar ! 1 votes 1 votes arks commented Jan 3, 2023 reply Follow Share Backtracking parser(Top Down) can also work with Ambiguous Grammar, since it is basically a Breadth first search for the string. 0 votes 0 votes arks commented Jan 3, 2023 reply Follow Share Disambiguation can be done using 2 properties: associativity and precedence. Using that, any of the LR(0)/ LR(1) parsers can be used to parse ambiguous Grammars. And since if a Grammar is ambiguous or not is a undecidable problem, people already use tools like YACC to disambiguate grammars. Check this : https://www.geeksforgeeks.org/parsing-ambiguos-grammars-using-lr-parser/ 0 votes 0 votes Please log in or register to add a comment.