The GATE Grind

GATE 2022 CS – Question 13

Compiler Design · Parsing and Syntax Analysis · 1 mark · Multiple choice

Which one of the following statements is TRUE?

  1. 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.
  2. Symbol table is accessed only during the lexical analysis phase.
  3. Data flow analysis is necessary for run-time memory management.
  4. $LR(1)$ parsing is sufficient for deterministic context-free languages.

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (D) $LR(1)$ parsing is sufficient for deterministic context-free languages.

Explanation

Every DCFL has an LR(1) grammar. Merging LR(1) states into LALR(1) can introduce reduce-reduce conflicts, so A is false. The symbol table is used in many phases, and data flow analysis is a compile-time optimization.