GATE Computer ScienceHardGATE CS (PYQ pattern)
Using the backpatching scheme (each relation gives 'if r goto _' then 'goto _', no fall-through optimisation, numbering from 100), the code for while (a < b || c < d) while (e < f && g < h) x = x + 1; is generated. To which instruction number does the 'goto _' at 101 (the false exit of a < b) jump?
- A. 100
- B. 104
- C. 102
- D. 108
Correct answer: C. 102
The false exit of a<b in an 'or' goes to the test of c<d, which starts at 102.
More Compiler Design questions
- For the nested-loop code 1: s = 0; 2: i = 0; 3: L1: if i >= n goto L5; 4: j = 0; 5: L2: if j >= i goto L4; 6: s = s + j; 7: j = j + 1; 8…
- For the grammar E → T E'; E' → + T E' | ε; T → F T'; T' → F T' | ε; F → ( E ) | id, what is FOLLOW(T)?
- Which of the following about iterative data-flow analyses is/are true? I. Live-variable analysis is a backward problem whose meet operator…
- For the code 1: x = 0; 2: y = 1; 3: L1: if x > n goto L4; 4: if y > m goto L2; 5: y = y + x; 6: goto L3; 7: L2: x = x + 2; 8: L3: x = x +…
- For the grammar S → A B; A → a | ε; B → A b | c, what is FOLLOW(A)?
- Expressions are compared textually and an assignment to an operand kills the expressions that use it. Which expressions are available on…