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

Discussion

Character classes are used in scanner specifications chiefly to

  • A.let the parser rather than the scanner handle all the punctuation
  • B.avoid the need for a longest match rule during scanning
  • C.keep the specification short and the transition table compact
  • D.allow the scanner to recognise context free constructs

Answer: C

Correct answer: keep the specification short and the transition table compact

Grouping the twenty-six letters into a single class means the specification says letter once instead of listing them, and the transition table needs one column for the class rather than twenty-six. Both effects matter: the first for writing and maintaining the rules, the second for the size of the generated scanner.

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

Post your comment

Please log in or register to post a comment.