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

Discussion

The chief practical advantage of a generated scanner over a hand written one is

  • A.the generated scanner always runs faster than any hand written one
  • B.generated scanners can recognise context free languages too
  • C.a generated scanner needs no interface to the parser at all
  • D.the specification is short, declarative and easy to change

Answer: D

Correct answer: the specification is short, declarative and easy to change

A Lex specification states what the tokens look like and leaves the construction of the automaton to the tool, so it is a fraction of the length of the equivalent code and can be changed by editing one pattern. A carefully hand-written scanner can be faster, so speed is not the argument; maintainability is.

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

Post your comment

Please log in or register to post a comment.