Question:

The output of a lexical analyzer is which one of the following?

Show Hint

Lexical analysis converts characters into tokens, while syntax analysis converts tokens into a parse structure.
Updated On: Feb 8, 2026
  • A parse tree
  • Intermediate code
  • Machine code
  • A stream of tokens
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is D

Solution and Explanation

Step 1: Understanding the role of a lexical analyzer.
The lexical analyzer (also called scanner) is the first phase of a compiler. It reads the source program as a sequence of characters.
Step 2: Identifying its main task.
Its primary function is to group characters into meaningful units called tokens, such as identifiers, keywords, operators, and literals.
Step 3: Output produced by lexical analysis.
After scanning the input, the lexical analyzer outputs a sequence (stream) of tokens, which is then passed to the syntax analyzer (parser).
Step 4: Final conclusion.
Hence, the correct output of a lexical analyzer is a stream of tokens.
Was this answer helpful?
0
0