Which one of the following statements is TRUE?
(A)
The LALR(1) parser for a grammar G cannot have a reduce-reduce conflict if the LR(1) parser for G does not have reduce-reduce conflict.
(B)
The symbol table is accessed only during the lexical analysis phase.
(C)
Data flow analysis is necessary for run-time memory management.
(D)
LR(1) parsing is sufficient for deterministic context-free languages.
Answer: (D)
Explanation:
Option A: False. Not necessary. Merging or combining the states with the same state and different lookahead may also lead to the R-R conflict in LALR(1) parser.
Option B: False. Symbols table can be used with all phases of compilation and will be used at different stages. Not necessarily with lexical analysis phase only
Option C: False. It is not necessary but we may apply it for the optimizations and finding the minimum number of registers and analyzing the code etc.
Option D: True. The LR parser can recognize any deterministic context-free language in linear-bounded time.
Quiz of this Question
Please comment below if you find anything wrong in the above post