MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
In SLR parsing for the grammar E’
A
Both will have shift-reduce conflict
B
Only ‘a’ will have shift-reduce conflict
C
Only ‘b’ will have shift-reduce conflict
D
Neither of the other option
Explanation: 

Detailed explanation-1: -SLR (1) refers to simple LR Parsing. It is same as LR(0) parsing. The only difference is in the parsing table.To construct SLR (1) parsing table, we use canonical collection of LR (0) item. In the SLR (1) parsing, we place the reduce move only in the follow of left hand side.

Detailed explanation-2: -If you can construct a parsing table and there are no conflicts, it’s SLR(1).

Detailed explanation-3: -False, LALR(1) parser is more powerful than SLR(1) and LR(0) parser. LALR offers a good solution, because LALR(1) grammars are more powerful than SLR(1), and can parse most practical LL(1) grammars.

There is 1 question to complete.