1.

The grammar S → aSa | bS | c is?(a) LL(1) but not LR(1)(b) LR(1) but not LR(1)(c) Both LL(1) but not LR(1) & LR(1) but not LR(1)(d) None of the mentionedI had been asked this question in an interview for job.The query is from Error Recovery in LR phase in section Error Handling of Compiler

Answer»

Correct OPTION is (c) Both LL(1) but not LR(1) & LR(1) but not LR(1)

EXPLANATION: First(aSa) = a

First(BS) = b

First(c) = c

LR parsers are more powerful than LL (1) parsers and LR (1).



Discussion

No Comment Found

Related InterviewSolutions