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

Discussion

What the scanner hands on to the next phase of the compiler is

  • A.a sequence of target machine instructions ready for assembly
  • B.a sequence of tokens with their attribute values attached
  • C.a parse tree representing the structure of the whole program
  • D.an annotated syntax tree carrying the types of all expressions

Answer: B

Correct answer: a sequence of tokens with their attribute values attached

The scanner groups characters into lexemes and classifies each as a token, attaching attributes - typically a pointer to the symbol table entry for an identifier, or the value of a numeric literal.

The attributes matter as much as the classification: the parser needs only the token type to decide the grammar, but later phases need the identity of the particular identifier or the value of the particular constant. The other three options name outputs of the parser, the semantic analyser and the back end.

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

Post your comment

Please log in or register to post a comment.