1.

An LALR(1) parser for a grammar can have shift-reduce (S-R) conflicts if and only if ___________(a) The SLR(1) parser for G has S-R conflicts(b) The LR(1) parser for G has S-R conflicts(c) The LR(0) parser for G has S-R conflicts(d) The LALR(1) parser for G has reduce-reduce conflictsThe question was posed to me in homework.My query is from Intermediate Code-Generation topic in chapter Syntax Directed Definition and Translations of Compiler

Answer»

Correct OPTION is (B) The LR(1) parser for G has S-R conflicts

The best explanation: LALR parser is reduced form of CLR or LR(1) parser, LALR parser uses the LR(1) items of CLR parser & of any shift REDUCE conflicts are there then it is due to LR(1) parser.



Discussion

No Comment Found

Related InterviewSolutions