Return to the Fortran tools home page
I also provide links to other Fortran parsing and semantic analysis tools.
I would appreciate any other related information including:
-
Links to Fortran grammars for other tools and
-
Tools that output Fortran code.
I am aware of the following grammars:
-
Fortran 77 only
-
Fortran 90/95/HPF
-
Waite's (discussed above)
-
The front end to the G95 project.
This front end is not complete yet, but is getting close.
-
The front end to the
University
of Syracuse public domain HPF/F90 compiler that I have not examined
in any detail. The discussion in their implementation document indicates
that they initially considered Eli but decided to base the front end on YACC/LEX
and the back end on SAGE++ libraries. The back end is not currently available.
-
A SAGE++
implementation by
Shridar Diwan and others that is partly based on Eli. This is based
on an older version of Waite's grammar that had some problems, and on a no
longer supported version of SAGE++. The Eli semantics analysis portion of
the tool is non-linear and takes a long time to generate code for the analyzer.
I did not attempt to use their semantics analysis given the need to learn
a new tool, the fact that work on Sage++ seemed to be dormant, and the long
turnaround time given the non-linearity.
-
ADAPTOR
an implementation of HPF 2.0 and F90 as a source to source translator to
Fortran. (It lacks some of F95.) I only found out about this system after
I had essentially finished my Eli syntactic analysis and started my semantics
analysis. Much of the system, particularly the source to source translator
of greatest interest to me, is in the public domain implemented using a
subset of
the GMD-Karlsruhe compiler tools Cocktail. I have recently downloaded the
front end for this system, for reading while my trick shoulder recovers from
repetitive strain. It is not as well documented as Waite's, but the coding
appears to be more straightforward and it performs a more extensive semantics
analysis. It appears to be more legible than Diwan's grammar and analysis.
Comments in the documentation and code suggest that it is not as robust as
Waite's in its handling of Fortran's many lexical problems, not always dealing
properly with whitespace or the lack of reserved keywords. It does not appear
to make significant use of some of Cocktail's more advanced tools, the many
preprocessors, or LARK the LALR(k) parser generator available with the commercial
version of Cocktail.
-
The University of Southampton
SHPF
HPF 2.0 compiler. Written in C which presumably implies that most of the
parsing is recursive descent.
-
SNIFF+ a commercial
package.
-
Cocktail
-
PIPS
I have heard that Wetherell of Lawrence Livermore National Laboratory had
a Fortran based parser generator, LR, but I have not seen an on-line reference
or a reference to any other such Fortran based parser generator. If any one
is interested in writing one, I suggest basing it on a system available in
the public domain. I can suggest several criteria, unfortunately currently
mutually exclusive, for choosing the base system:
-
Compatibility with Eli so that my work could be reused;
-
Recursive descent (as opposed to YACC's table driven ascent) for better error
reporting and code interfacing (and modification);
-
Backtracking
for more flexible grammars; and
-
Simple implementation, for rapid availability.
Of the available tools the following satisfy several of the above requirements:
-
Adrian Johnstone 's
RDP
implements recursive descent in a very simple implementation. He should soon
(?he's been promising it about a year now) have available a new version,
GRDP
, which includes backtracking
-
BTYACC , an improved version
of YACC with backtracking. A relatively simple implementation, but the fact
that it is table driven does make the code more difficult to interface with
and understand.
-
PCCTS or
ANTLR . A more complicated implementation
with recursive descent and backtracking. ANTLR 2.x's implementation reputedly
relies on Java's exception handling to implement backtracking, and hence
may be difficult to port to Fortran, although the system can generate C++
as well as Java as output. The main weakness of the system is the lack of
an associated attribute manipulation library.
-
PRECC-X
. A complicated implementation with recursive descent and backtracking.
-
Depot4 . A moderately
complicated implementation with recursive descent and backtracking. Systems
available for Oberon and Java.
-
Cocktail , a sophisticated
package available with output for several languages, C, C++, Modula 2, Ada
95, and Eiffel. This would be useful in extending Adaptor's analysis. Some
of the documentation implies that the libraries rely on unions, which may
make generating Fortran output difficult. As with Eli, Cocktail has more
languages for the different tools than suits my taste. The syntax is less
wordy than Eli's and better suited to the initial pass of a compiler as actions
can be directly associated with the syntax. Operator specifications are simpler
and not as sophisticated as Eli's. The standard syntax for associating terminals
with attributes is relatively traditional and not as nice as Eli's. A
preprocessor provides an alternative attribute syntax, that is an improvement,
but still not as good as Eli's.
Return to the Fortran tools home page
Return to W.B. Clodius's personal home page
Comments and questions to wclodius@aol.com
W.B. Clodius, wclodius@aol.com, Revised 1999-10-22