Match List I with List II according to the input consumed by each compiler…

2023

Match List I with List II according to the input consumed by each compiler phase.

List I (Input)

(A) Syntax tree

(B) Intermediate representation

(C) Token stream

(D) Character stream

List II (Compiler phase)

(I) Code generator

(II) Semantic analyzer

(III) Lexical analyzer

(IV) Syntax analyser

Choose the correct answer from the options given below.

  1. A.

    (A)-(IV),(B)-(III),(C)-(I),(D)-(II)

  2. B.

    (A)-(II),(B)-(I),(C)-(IV),(D)-(III)

  3. C.

    (A)-(II),(B)-(IV),(C)-(I),(D)-(III)

  4. D.

    (A)-(IV),(B)-(I),(C)-(II),(D)-(III)

Attempted by 306 students.

Show answer & explanation

Correct answer: B

Correct answer: (A)-(II), (B)-(I), (C)-(IV), (D)-(III)

  • Syntax tree -> Semantic analyzer: the parser produces the syntax tree, and semantic analysis checks meaning, scope, and type rules on it.

  • Intermediate representation -> Code generator: code generation converts the intermediate representation into target code.

  • Token stream -> Syntax analyser: lexical analysis produces tokens, but the parser/syntax analyser consumes that token stream.

  • Character stream -> Lexical analyzer: the lexical analyzer reads source characters and groups them into tokens.

The important distinction is that lexical analysis produces the token stream, while syntax analysis uses that token stream as its input.

Explore the full course: Mppsc Assistant Professor