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

Discussion

Consider the following statements about scanner generators.
1. They resolve ties between equal length matches by rule order.
2. They apply the longest match rule when patterns overlap.
3. They require the token patterns to be context free grammars.

  • A.1 only
  • B.All of them
  • C.1 and 2 only
  • D.3 only

Answer: C

Correct answer: 1 and 2 only

Statements 1 and 2 are the two disambiguation rules, and they are applied in that order: longest match first, then rule order to settle a tie. Statement 3 is wrong - the patterns are regular expressions, not context free grammars, which is precisely what makes the mechanical construction of an automaton possible.

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

Post your comment

Please log in or register to post a comment.