GATE / CS ARCHIVE

GATE CSE 2015 SET 2 / QUESTION 27

GATE CSE 2015 Set 2 Q27

Compiler Design · Compiler Phases, Linking & Loading · Full GATE CSE 2015 Set 2 paper

GATE 2015 Set 2, Q27 1 mark · MCQ
Report issue

Compiler Phases, Linking & Loading

Question 27, GATE 2015: Match P lexical analysis, Q parsing, R register allocation, S expression evaluation with 1 graph colouring, 2 DFA minimization, 3 postorder traversal, 4 production tree. A P2Q3R1S4; B P2Q1R4S3; C P2Q4R1S3; D P2Q3R4S1.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Lexical analysis uses minimized DFAs; parsing constructs production/parse trees; register allocation uses interference-graph coloring; expression evaluation visits operands before operators in postorder. Therefore P-2, Q-4, R-1, S-3, C.

Lexical patterns are recognized by finite automata, which can be minimized without changing recognized tokens. Parsing uses grammar productions organized into a parse tree. Register-allocation interference graphs put simultaneously live variables at adjacent vertices, so colouring assigns nonconflicting registers. To evaluate an expression tree, children must be evaluated before their operator parent, which is postorder. Combining all four gives the single complete matching C.

Original paper, page 35 · Answer key