GATE Computer ScienceEasyGATE CS (PYQ pattern)
A basic block compiles to six three-address statements: t1 = a + b; t2 = c * d; t3 = a + b; t4 = t1 * t2; t5 = t3 − t4; x = t5. Value numbering shows t1 and t3 are identical. Using indirect triples (each unique triple stored once, a triple takes 3 words, and each statement owns one pointer word in the statement list), how many words are needed in total?
- A. 24
- B. 18
- C. 21
- D. 20
Correct answer: C. 21
Unique triples: (+ a b), (* c d), (* (0) (1)), (− (0) (2)), (= x (3)): 5 triples = 15 words, plus 6 pointers = 21. Quadruples would use 6 × 4 = 24.
More Compiler Design questions
- After applying left factoring repeatedly (each time extracting the longest common prefix of alternatives that share a first symbol…
- Consider the grammar S → A B c, A → a A | ε, B → b B | A d | ε. How many terminals are in FOLLOW(A), and is the grammar LL(1)?
- For the grammar S → A B, A → a A | a, B → b, the augmented canonical LR(0) collection has how many states, and what is the strongest class…
- In the expression a = (b + c) (b + c) - d / (b + c), the numbers of operator (internal) nodes in the syntax tree for the right-hand side…
- A C lexer applies the longest-match (maximal munch) rule. The number of tokens in the statement x = a---bc++; is:
- Which of the following grammars are LL(1)? (I) S → a S b | ε. (II) S → a S a | a. (III) S → A B, A → a | ε, B → a | b. (IV) S → a S | b S…