GATE Computer ScienceVery hardGATE CSE
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) automaton have, and by how many does LALR(1) reduce it?
- A. 22 states, reduced by 8
- B. 22 states, reduced by 10
- C. 12 states, reduced by 10
- D. 24 states, reduced by 10
Correct answer: B. 22 states, reduced by 10
LR(0)/LALR have 12 states; the canonical LR(1) automaton has 22, so merging removes 10.
More Compiler Design questions
- 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…
- A DFA reads binary strings most-significant bit first and accepts those whose numeric value is divisible by 12 (the empty string counts as…
- Let L = { w ∈ {a,b} : w contains the substring "aba" and |w| is even }. How many states does the minimal DFA for L have?