Machine-translated by Google. Questions are authored in English.
Top

Discussion

The input to the lexical analyser is

  • A.a stream of characters making up the source program
  • B.a stream of tokens produced by an earlier phase of the compiler
  • C.a syntax tree constructed from the statements of the program
  • D.the three address code emitted by the intermediate generator

Answer: A

Correct answer: a stream of characters making up the source program

The lexical analyser is the first phase to touch the program, so its input is the raw character stream as it stands in the file.

Its output is a stream of tokens, which is what the parser consumes - the second option describes the input to the next phase rather than to this one. A syntax tree and three-address code are produced later still, by the parser and the intermediate code generator. Each phase's input is the previous phase's output, and the scanner sits at the head of the chain.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.