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

Discussion

Lookahead in a scanner refers to

  • A.deferring the decision about a token until semantic analysis
  • B.examining characters beyond the current lexeme before deciding
  • C.fetching a further token in advance of the parser asking for one
  • D.consulting the symbol table for the attributes of a name

Answer: B

Deciding between a one character and a two character comparison operator needs one character of lookahead. Some constructs, notably the classic Fortran DO statement, need arbitrarily much, which is one reason such designs are now avoided.

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

Post your comment

Please log in or register to post a comment.