GATE / CS ARCHIVE

GATE CSE 1993 / QUESTION 1.4

FORTRAN77 keywords as identifiers

Compiler Design · Lexical Analysis · Full GATE CSE 1993 paper

GATE 1993, Q1.4 MSQ
Report issue

Lexical Analysis

Question 1.4, GATE 1993: Which fixed-form FORTRAN77 statements are valid: DO 13 I = 1; A = DIM ***7; READ = 15.0; GO TO 3 = 10?
Tap to enlarge
Select all that apply
Answer & solution

Answer: A,C,D as assignment statements (no official key was published)

FORTRAN77 does not reserve these apparent keywords, and blanks outside character constants do not distinguish tokens in fixed form. DO 13 I = 1 can therefore be an assignment to variable DO13I, not a DO loop. READ=15.0 assigns to variable READ, and GO TO 3=10 assigns to GOTO3. These names satisfy the traditional letter-first length rule. DIM***7 has an invalid triple-star operator and is not a valid exponentiation expression. The answer concerns statements placed in valid fixed-form source columns and with ordinary implicit typing, not modern free-form parsing.

Original paper, page 1