GATE / CS ARCHIVE

GATE CSE 1999 / QUESTION 2.14

Blank-insensitive FORTRAN tokenization

Compiler Design · Lexical Analysis · Full GATE CSE 1999 paper

GATE 1999, Q2.14 2 marks · MSQ
Report issue

Lexical Analysis

Question 2.14, GATE 1999: Count tokens in legacy FORTRAN DO 10 I = 1.25. Options 3,4,5,none; the number contains a decimal point, not a comma.
Tap to enlarge
Select all that apply
Answer & solution

Answer: A: 3 (no official key was published)

In the classic fixed-form FORTRAN lexical convention, embedded blanks are insignificant outside literals. Thus DO 10 I becomes the identifier DO10I when the remainder is an assignment rather than a valid DO-loop header. The decimal point in 1.25 means this is not the loop form DO 10 I=1,25. Its tokens are identifier DO10I, assignment equals, and real literal 1.25: three, A.

Original paper, page 5