GATE Computer ScienceHardGATE CS (PYQ pattern)
Construct the SLR(1) parsing table of S → a S b S | b S a S | ε (augmented). In how many states of the SLR(1) automaton does the ACTION part have at least one conflicting cell?
- A. 7
- B. 2
- C. 6
- D. 5
Correct answer: D. 5
Using FOLLOW sets as reduce lookaheads, 5 states contain a multiply-defined ACTION cell (10 cells in all).
More Compiler Design questions
- G1: S → A B; A → a A | c; B → a B | c. G2: S → A B A; A → a A | c; B → b B | c. For each, how many more states does the canonical LR(1)…
- The grammar S → ( S ) S | ε is both LL(1) and SLR(1). On the input "( ( ) ) ( )", how many times does the LL(1) parser expand S → ε, and…
- Integer code: a = 4; b = a 2; c = b + n; d = c 0; e = d + b; f = e - 8; g = n + f; h = g 1; r = h. Only r is live at the end. The…
- For S → A | x b; A → a A b | B; B → x (augmented), how many states does the canonical LR(1) automaton have, and in how many states of the…
- A yacc-generated parser for E → E op E | num uses the precedence declarations %left ''; %right '-'; %left '+' (in this order, so + binds…
- Consider strings containing both ab and bb as substrings in either order (overlaps allowed). How many states does the minimal complete DFA…