GATE Computer ScienceModerateNIELIT Scientist B
For the standard expression grammar E → T E′; E′ → + T E′ | ε; T → F T′; T′ → * F T′ | ε; F → ( E ) | id, how many symbols (including $) are in FOLLOW(T′)?
- A. 2
- B. 4
- C. 3
- D. 5
Correct answer: C. 3
FOLLOW(T′) = FOLLOW(T) = {+, ), $} (T is followed by E′, which is nullable), so 3.
More Compiler Design questions
- How many states does the canonical LR(0) collection of the augmented grammar S′ → S; S → A A; A → a A | b contain?
- 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?