COMPILER DESIGN

SYNTAX ANALYSIS

ROLE OF THE PARSER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Top down parser can’t handle ____
A
Left Recursion (LR)
B
Left Factoring (LF)
C
Both LR and LF
D
only LR
Explanation: 

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

There is 1 question to complete.