GATE Computer ScienceModerateGATE CS · ISRO
How many states does the canonical LR(0) collection of the augmented grammar S′ → S; S → A A; A → a A | b contain?
- A. 6
- B. 7
- C. 8
- D. 9
Correct answer: B. 7
Constructing the closure and goto sets from I0 gives 7 distinct item sets.
More Compiler Design questions
- What is the number of states in the minimal DFA for the regular expression (a|b)abb?
- Three-address code (at most one operator per instruction, the last instruction assigning to x) is generated for x = ab + c(d − e) − f/g…
- With ^ right-associative and higher than which is higher than + and − (both left-associative), what is the postfix form of a − b c ^ d ^ e…
- Consider this three-address code: 1: i = 0; 2: s = 0; 3: if i >= n goto 9; 4: t = a[i]; 5: if t < 0 goto 7; 6: s = s + t; 7: i = i + 1; 8…
- Using E → E + T | T; T → T F | F; F → id, how many reductions does a bottom-up parser perform for the input id + id id?
- In the grammar S → A B c | d; A → B B | a; B → b | ε; C → A C | ε, how many non-terminals are nullable?