Project ForgeSign up free
Compiler Design
Lexical Analysis & Parsing
GATE 2022
Hard

Which one of the following statements is TRUE?

  • AThe LALR(1) parser for a grammar G cannot have reduce-reduce conflict if the LR(1) parser for G does not have reduce-reduce conflict.
  • BSymbol table is accessed only during the lexical analysis phase.
  • CData flow analysis is necessary for run-time memory management.
  • LR(1) parsing is sufficient for deterministic context-free languages.

Explanation

(A) is FALSE: merging LR(1) states with identical cores to form LALR(1) states CAN introduce NEW reduce-reduce conflicts that weren't present in the canonical LR(1) automaton — a well-known LALR limitation. (B) is FALSE: the symbol table is accessed throughout compilation (semantic analysis, code generation), not just lexical analysis. (C) is FALSE: data flow analysis is used for optimization, not for run-time memory management. (D) is TRUE: it's a foundational theorem that the class of languages parsable by LR(1) grammars is EXACTLY the class of deterministic context-free languages — LR(1) parsing is both necessary and sufficient.

Source: GATE CS 2022 (2022)

This question is part of a 15-day revision cycle — sign in and Project Forge will bring it back the day before you'd forget it.

Start revising free