GATE Computer ScienceVery hardGATE CSE
Grammar: S → L = R | R; L → * R | id; R → L (augmented with S' → S). How many states do the LR(0) automaton and the canonical LR(1) automaton have, and how many states does the LALR(1) automaton have?
- A. 10, 14 and 14
- B. 11, 14 and 10
- C. 10, 16 and 11
- D. 10, 14 and 10
Correct answer: D. 10, 14 and 10
LR(0) has 10 states; canonical LR(1) splits some into 14; merging LR(1) states with equal cores returns 10, the same as LR(0).
More Compiler Design questions
- Grammar: S → a A d | b B d | a B e | b A e; A → c; B → c. How many states does the canonical LR(1) collection contain, how many does…
- For the standard expression grammar E → E + T | T; T → T F | F; F → ( E ) | id (augmented), how many states does the canonical LR(1)…
- For S → C C; C → c C | d (augmented), the canonical LR(1) collection has some states that share an LR(0) core. By how many states does…
- Grammar: S → A a | b A c | d c | b d a; A → d. How many conflicting (state, terminal) entries are there in its SLR(1) table, and how many…
- Consider the grammar S → a S | a S b S | ε. How many distinct parse trees does the string aaabb have?
- Procedure swap(x, y) { t = x; x = y; y = t; } is called as swap(i, a[i]) with i = 1 and a[1], a[2], a[3] = 2, 5, 9. Under call-by-name…