GATE Computer ScienceVery hardGATE CSE · UGC NET
Grammar: S → A B C; A → a | ε; B → a | b | ε; C → a | c | ε. How many cells of the LL(1) table contain more than one production?
- A. 3
- B. 1
- C. 2
- D. 5
Correct answer: C. 2
FOLLOW(C) = {$}, FOLLOW(B) = {a, c, $}, FOLLOW(A) = {a, b, c, $}. Multiply-defined cells: A|a, B|a.
More Compiler Design questions
- A lexer uses longest match, with ties broken in favour of the rule listed first. Rules in order: IF = "if"; ELSE = "else"; ID =…
- Three-address code: 1: x = 0; 2: if a > b goto 8; 3: x = x + 1; 4: if x > 5 goto 7; 5: y = y 2; 6: goto 2; 7: y = y + 1; 8: if y < 100…
- Grammar: S → L = R | R; L → R | id; R → L, augmented with S' → S. How many distinct LR(1) items (production, dot position, lookahead) does…
- Grammar: S → a S b | S S | ε. How many distinct strings of length exactly 10 belong to the language it generates?
- Backpatching with no fall-through optimisation, numbering from 100, translates while (a < b && c < d || e < f) { if (x < y) p = 1; else q…
- For the augmented grammar S′ → S; S → a S a | b S b | c, how many states does the canonical LR(1) automaton have, and how many does the…