MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Consider the following two sets of LR (1) items of an LR (1) grammar. X
A
1 only
B
2 only
C
1 and 4 only
D
1, 2, 3 and 4 only
Explanation: 

Detailed explanation-1: -A grammar is LR(1) if the following two conditions are satisfied for each configurating set: 1. For any item in the set [A –> u•xv, a] with x a terminal, there is no item in the set of the form [B –> v•, x]. In the action table, this translates no shiftreduce conflict for any state.

Detailed explanation-2: -LR (1) item is a collection of LR (0) items and a look ahead symbol. The look ahead is used to determine that where we place the final item. The look ahead always add $ symbol for the argument production.

Detailed explanation-3: -LR(1) items An LR(1) item has the form [I, t] where I is an LR(0) item and t is a token. As the dot moves through the right-hand side of I, token t remains attached to it. LR(1) item [A → ⋅, t] calls for a reduce action when the lookahead is t.

Detailed explanation-4: -Explanation: Canonical LR is the most powerful parser as compared to other LR parsers.

There is 1 question to complete.