GATE Computer ScienceVery hardGATE CS (PYQ pattern)
Backpatching with no fall-through optimisation, numbering from 100, translates while (a < b && c < d || e < f) { if (x < y) p = 1; else q = 2; } into three-address code. The loop's body starts right after the test code. What target does the instruction 'goto _' generated for the FALSE exit of the test c < d (the 4th instruction, number 103) receive?
- A. 100
- B. 104
- C. 105
- D. 106
Correct answer: B. 104
The false list of 'a<b && c<d' is merged into the false list of the whole && , which the 'or' backpatches to the start of 'e<f' (instruction 104).
More Compiler Design questions
- 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…
- For the grammar G: S → A b | B c; A → a A | ε; B → a B | ε, the LL(1) predictive table is built. Which statement is correct?
- For G: S → a A | b B; A → c A d | ε; B → c B d d | ε, which statements are true? I. G is LL(1). II. G is LR(0). III. The canonical LR(1)…
- A scanner has two token rules, R1 = a b and R2 = b c. It always takes the longest prefix matching some rule and never backtracks over a…
- Register allocation by graph colouring is done on the loop 1: L1: v1 = v4 + 1; 2: v2 = v5 + 1; 3: v3 = v1 + 1; 4: v4 = v2 + 1; 5: v5 = v3…
- An array is declared A[L..10][−4..5] with 4-byte elements and stored in row-major order starting at address 1744. If the address of…