Compiler Phases, Linking & Loading

Answer & solution
Official answer: B
Lexical analysis uses regular expressions; top-down parsing constructs a leftmost derivation; semantic analysis checks types; runtime environments organize activation records. Hence P-iii, Q-i, R-ii, S-iv, B.
A lexer recognizes tokens such as identifiers and numbers from character patterns. A top-down parser expands the leftmost pending nonterminal toward the input. Semantic analysis rejects type-incompatible expressions even when their syntax parses. Activation records store each call’s parameters, locals and return information at runtime; this separates all four roles.