Question:medium

Which one of the following statements is TRUE?

Show Hint

LR(1) parsing is powerful enough to handle deterministic context-free languages and is widely used in efficient compiler construction.
Updated On: Jan 30, 2026
  • The 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.
  • Symbol table is accessed only during the lexical analysis phase.
  • Data flow analysis is necessary for run-time memory management.
  • LR(1) parsing is sufficient for deterministic context-free languages.
Show Solution

The Correct Option is D

Solution and Explanation

Let us examine each option carefully using standard concepts from compiler design.

Option (A) – False:
Although LR(1) parsers are more powerful than LALR(1) parsers, converting an LR(1) parser to an LALR(1) parser involves merging states with identical LR(0) cores. This merging can introduce reduce–reduce conflicts that were not present in the original LR(1) parser. Hence, it is incorrect to say that LALR(1) will never have such conflicts if LR(1) does not. Therefore, this statement is false.

Option (B) – False:
The symbol table is not used only during lexical analysis. While entries may be created during lexical analysis, the symbol table is extensively accessed and updated during syntax analysis, semantic analysis, and even during code generation. Hence, restricting its use to lexical analysis alone is incorrect.

Option (C) – False:
Data flow analysis is a compile-time technique used to gather information about the possible values of variables at different points in a program. It is mainly used for optimization and error detection. It does not deal with run-time memory management, which is handled by mechanisms such as stack and heap management. Therefore, this statement is false.

Option (D) – True:
Deterministic context-free languages (DCFLs) are exactly the class of languages that can be parsed by deterministic pushdown automata. LR(1) parsers are powerful enough to parse all deterministic context-free languages using one symbol of lookahead. Hence, LR(1) parsing is sufficient for DCFLs, making this statement correct.

Final Answer: (D)
Was this answer helpful?
0