SYNTAX ANALYSIS
ROLE OF THE PARSER
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Left Recursion (LR)
|
|
Left Factoring (LF)
|
|
Both LR and LF
|
|
only LR
|
Detailed explanation-1: -A top-down parser cannot handle left recursive productions. To understand why not, let’s take a very simple left-recursive grammar.
Detailed explanation-2: -In short, top-down parsers usually try to guess what to do from limited information about the string. Because of this, they get confused by left recursion because they can’t always accurately predict which productions to use. Hope this helps!
Detailed explanation-3: -Drawback of Top-Down Parsing The reason that top-down parsing follow the left-most derivation for an input string and not the right-most derivation is that the input string is scanned by the parser from left to right, one symbol/token at a time.
Detailed explanation-4: -Top-down parsing is unable to handle left recursion in the present in the grammar. Some recursive descent parsing may require backtracking. 13-Jan-2022