SF3LEX 1L "29 April 1994" "University of Utah "
Table of contents
sf3lex - SFTRAN3 and Fortran lexical analyzer
is a simple prototype SFTRAN3 lexical analyzer program. Since SFTRAN3
is a superset of Fortran 66 and Fortran 77, it will handle Fortran
code as well. The analyzer just prints the token name, its internal
number, and the token string, one such group per line, to
This is not of much use to a user, but it is useful in checking the
input to other tools that use the same lexical analyzer.
The lexical analyzer used by
recognizes the complete Fortran 66 and 77 languages as defined in ANSI
Fortran X3.9-1966 and ANSI Fortran X3.9-1978 Standards. It also
recognizes the SFTRAN3 language keywords and directives as described
in the SFTRAN3 Programmer's Reference Manual by Charles L. Lawson and
John A. Flynn (JPL Document No. 1846-98, 1978, Jet Propulsion
Laboratory, Pasadena, CA).
To increase its utility, the analyzer also recognizes numerous
language extensions present in commonly-used Fortran compilers. These
are summarized in the following table. Note that some extensions
are supported by multiple vendors.
<letter>=, Rw, and nVw.d FORMAT items,
nRxxxx right-adjusted Hollerith constant, "xxx" quoted
n/ FORMAT item
ACCEPT, DO ... ENDDO, IMPLICIT NONE,
INCLUDE, REREAD, and TYPE statements, E,
F, G, I, Ow.d, Q, Zw.d, and
$ FORMAT items, long variable names, $ and %
in variable names, tabbed source format, lower-case source format
&nnn alternate return specifier, NAMELIST I/O
B, P, nR, SU, T, and nT
Standard input and standard output only.
Although a complete grammar for SFTRAN3 and Fortran 66/77 is
implemented, with extensions from DEC, UNIX, Cray, CDC, and IBM
Fortran, the constraints of doing this with a machine-generated
lexical analyzer are that
is a reserved word, and some tokens may be incorrectly identified
because the grammar may require lookahead of many tokens to correctly
classify an earlier one. A tool to preprocess the output of the
analyzer and reclassify tokens will eventually be written.
Nelson H. F. Beebe
Center for Scientific Computing
Department of Mathematics
University of Utah
Salt Lake City, UT 84112
Tel: +1 801 581 5254
FAX: +1 801 581 4148