MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
kinds of LR parser are
A
SLR, CLR and LALR
B
CCLR, LR and LLR
C
SR, SLR and CLR
D
SR, SLR and LALR
Explanation: 

Detailed explanation-1: -SLR Parser is the smallest in size. LALR and SLR have the same size. As they have less number of states. CLR Parser is the largest.

Detailed explanation-2: -There are several variants of LR parsers: SLR parsers, LALR parsers, Canonical LR(1) parsers, Minimal LR(1) parsers, and GLR parsers.

Detailed explanation-3: -An LALR(1) parser is an “upgraded” version of an LR(0) parser that keeps track of more precise information to disambiguate the grammar. An LR(1) parser is a significantly more powerful parser that keeps track of even more precise information than an LALR(1) parser.

Detailed explanation-4: -The correct answer is option 3. Canonical LR is the most powerful parser as compared to other LR parsers. Order: LR(0)< SLR < LALR < CLR.

Detailed explanation-5: -SLR parsers make use of canonical collection of LR(0) items for constructing the parsing tables. CLR parsers are uses LR(1) collection of items for constructing the parsing tables part. LALR parsers LR(1) collection, items with items having same core merged into a single itemset.

There is 1 question to complete.