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

Discussion

The Fortran statement DO 5 I = 1.25 is famously difficult to scan because

  • A.the variable I is implicitly typed as an integer by its name
  • B.Fortran permits blanks to be inserted anywhere within a name
  • C.it is an assignment while DO 5 I = 1,25 is a loop header
  • D.the number 5 could be either a label or a numeric literal

Answer: C

The two statements differ only in the character separating 1 and 25. The scanner cannot decide the nature of DO until it reaches that point, so unbounded lookahead is required. Modern language designs avoid such constructs precisely so that scanning stays simple.

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

Post your comment

Please log in or register to post a comment.