The GATE Grind

GATE 2017 CS (CS2) – Question 15

Compiler Design · Lexical Analysis · 1 mark · Multiple choice

Match compiler inputs P: syntax tree, Q: character stream, R: intermediate representation, S: token stream, to phases (i) code generator, (ii) syntax analyzer, (iii) semantic analyzer, (iv) lexical analyzer.

  1. P–ii,Q–iii,R–iv,S–i
  2. P–ii,Q–i,R–iii,S–iv
  3. P–iii,Q–iv,R–i,S–ii
  4. P–i,Q–iv,R–ii,S–iii

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (C) P–iii,Q–iv,R–i,S–ii

Explanation

Semantic analysis checks the syntax tree, P–iii. Lexical analysis consumes characters, Q–iv. Code generation consumes an intermediate representation, R–i. Syntax analysis consumes tokens, S–ii. The resulting mapping is C.

More Lexical Analysis questions

All Lexical Analysis questions →