MC logo

Problem 4.3: BNF for FORTRAN Subscripts


CS 404: Solutions and Examples

FORTRAN subscript expressions. I think he has in mind the discussion of limited FORTRAN subscripting on pp. 73, 74. With that in mind...
<subex>::=<varpart> | <integer> | <varpart> <addsub> <integer>
<addsub>::=+ | -
<varpart>::=<identifier> | <integer> * <identifier>
Where <identifier> and <integer> are defined on p. 165. Note that there are some things we don't describe with this notation. Specifically, that the variable names do not exceed 6 characters, and that the variables are integers. The former is possible with BNF, but niggling. The latter is not possible in BNF.

<<
>>