Which phase of compiler generates stream of atoms ?

2015

Which phase of compiler generates stream of atoms ?

  1. A.

    Syntax Analysis

  2. B.

    Lexical Analysis

  3. C.

    Code Generation

  4. D.

    Code Optimization

Attempted by 67 students.

Show answer & explanation

Correct answer: B

Answer: Lexical Analysis.

Explanation: Lexical analysis (also called scanning) reads the raw source characters and groups them into a stream of tokens (often called atoms).

  • What the lexical analyzer produces: tokens such as identifiers, keywords, operators, literals, and punctuation.

  • How those tokens are used: the parser (syntax analysis) consumes the token stream to build a parse tree or abstract syntax tree.

  • Why other phases are incorrect: code generation produces target code from an intermediate representation, and code optimization improves code quality; neither produces the initial token stream.

Explore the full course: Nta Ugc Net Paper 2

Loading lesson…