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

Discussion

Which of the following is NOT a duty of the lexical analyser?

  • A.counting the source line numbers needed for diagnostics
  • B.checking that operand types match their operator
  • C.stripping comments and white space
  • D.recognising numeric literals

Answer: B

The first three are all conventional scanner duties. Type compatibility requires knowledge of declarations and expression structure, which belongs firmly to semantic analysis. The scanner has no view of declarations and so cannot make any such judgement at all.

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

Post your comment

Please log in or register to post a comment.