GATE / CS ARCHIVE

GATE CSE 2009 / QUESTION 17

Compiler activity matching

Compiler Design · Compiler Phases, Linking & Loading · Full GATE CSE 2009 paper

GATE 2009, Q17 1 mark · MCQ
Report issue

Compiler Phases, Linking & Loading

Question 17, GATE 2009: Match P regular expressions, Q pushdown automata, R dataflow analysis, S register allocation to 1 syntax analysis, 2 code generation, 3 lexical analysis, 4 code optimization. A P4Q1R2S3; B P3Q1R4S2; C P3Q4R1S2; D P2Q1R4S3.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Regular expressions specify tokens for lexical analysis(P→3). Pushdown automata model syntax analysis(Q→1). Dataflow facts support code optimization(R→4), while register allocation is part of code generation(S→2). Hence B.

Regular expressions specify lexical tokens, giving P3. A pushdown store models nested grammatical structure in syntax analysis, giving Q1. Dataflow facts support optimizations such as dead-code elimination and constant propagation, giving R4. Register allocation assigns machine storage during code generation, giving S2. All four pairings are needed: option B is the unique complete match.

Original paper, page 3