SF3LEX 1L "29 April 1994" "University of Utah "
Table of contents
sf3lex - SFTRAN3 and Fortran lexical analyzer
sf3lex
<infile
>outfile
sf3lex
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
stdout.
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
sf3pretty
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.
Vendor
-
CDC
-
<letter>=, Rw, and nVw.d FORMAT items,
nRxxxx right-adjusted Hollerith constant, "xxx" quoted
strings
-
Cray
-
n/ FORMAT item
-
DEC
-
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
-
IBM
-
&nnn alternate return specifier, NAMELIST I/O
-
UNIX
-
B, P, nR, SU, T, and nT
FORMAT items
Standard input and standard output only.
fortlex(1L),
ftnchek(1L),
pfort(1L),
pretty(1L),
sf3(1L),
sf3pretty(1L),
sf3xref(1L),
xsf3(1L).
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
FORMAT
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
USA
Tel: +1 801 581 5254
FAX: +1 801 581 4148
Email: beebe@math.utah.edu