Home › GATE CSE › computerscience › Compiler Design › RECURSIVE DESCENT parsers translate each grammar…
RECURSIVE DESCENT parsers translate each grammar rule into
Aa lookup table
Ban SQL query
Can interrupt handler
Da function in the parser code
Answer & Solution
Correct answer: D. a function in the parser code
1. RECURSIVE DESCENT: top-down parser, written by hand or generated.
2. Each non-terminal in the grammar becomes one PARSING FUNCTION.
3. The function body matches the grammar rule's structure:
- Sequence A B → function calls parseA() then parseB()
- Alternative A | B → if/else looking at current token
- Repetition A* → while loop
4. The grammar reads almost directly from the parser code — makes recursive descent EASY TO WRITE and DEBUG.
5. Other options misdescribe the technique.
_Source: Bob Nystrom, "Crafting Interpreters", Ch 6.2 (Recursive Descent Parsing — overview)._
Related questions
The FOLLOW(A) set in LL parsing isThe FIRST(α) set of a string α in LL parsing isAfter the parser produces an AST, the next compiler phase is typicallyA SHIFT/REDUCE CONFLICT in an LR parser occurs whenWhich of these is a BOTTOM-UP (LR) parser feature?An LL(1) grammar requires that, given the leftmost non-terminal and ONE token of lookaheadLL parsers (recursive descent) parse from thePANIC MODE error recovery in a parser works by