scale.frontend.fortran
Class F95

java.lang.Object
  extended by scale.frontend.Parser
      extended by scale.frontend.fortran.F95

public class F95
extends Parser

This is the parser for the F95 version of CFortran, including f77, f90, and f95.

$Id: F95.java,v 1.80 2007-10-17 13:39:58 burrill Exp $

Copyright 2008 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.

While the name of the class is F95, it currently only implements the F77 standard.

Input Form

If the file extension of the source file pathname is .f90 or .f95, free-form input is assumed. Otherwise, fixed-form input is assumed. (Free-form input has not been tested.) In fixed-form input, all blanks are eliminated and all alphabetical characters are converted to lower case, before syntactical scanning is performed.

Scanning

In general, all scanning is accomplished by methods whose names begin with "next". The remainder of the method name specifies for what the method is scanning. Such a scanning method either recognizes that thing or not. If it does not recognize the thing, it returns an indication (generally a null) that the scan was not successful and resets the scan to the point at which it started. If the method has scanned far enough to know that it is scanning the appropriate construct and encounters something that does not conform, it throws an InvalidException. For example, consider the following statement:
   COMMON/abcx,y,z
 
The nextCommonStmt method knows that this is a COMMON statement once the '/' has been encountered. Thus, it throws an exception when the ',' is encountered. For
   DO10J=1,N
 
the nextAssignmentStmt method returns null when the comma is encountered.


Field Summary
static java.lang.String blankCommonName
          The name of blank common.
static boolean classTrace
           
static int F77
          Allow F77 features.
static int F90
          Allow F90 features.
static int F95
          Allow F96 features.
static boolean fullError
           
 
Fields inherited from class scale.frontend.Parser
extension, top
 
Constructor Summary
F95(Scale top, java.lang.String extension)
           
 
Method Summary
 void callback(int callback, Expression exp, BlockStmt bs)
          Called by ImpliedDo to generate code for implied-do loops.
protected  VariableDecl genTemp(Type t)
          Create a new temporary variable for use by the optimized code.
 SourceLanguage getSourceLanguage()
          Return the correct source langauge instance for this parser.
protected  int getStringLength(Type type)
          Return the Fortran CHARACTER type length or -1 if it is not a Fortran CHARACTER type.
 CallGraph parse(java.lang.String name, Suite suite, Vector<java.lang.String> macroText)
          Parse the specified Fortran file.
 void setColumn(int column)
          Set the source line scan position.
 
Methods inherited from class scale.frontend.Parser
getParser, runPreprocessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classTrace

public static boolean classTrace

fullError

public static boolean fullError

F77

public static final int F77
Allow F77 features.

See Also:
Constant Field Values

F90

public static final int F90
Allow F90 features.

See Also:
Constant Field Values

F95

public static final int F95
Allow F96 features.

See Also:
Constant Field Values

blankCommonName

public static final java.lang.String blankCommonName
The name of blank common.

See Also:
Constant Field Values
Constructor Detail

F95

public F95(Scale top,
           java.lang.String extension)
Parameters:
top - specifies the top level class of the compiler
extension - specifies the file extension of the file to be parsed
Method Detail

getSourceLanguage

public SourceLanguage getSourceLanguage()
Return the correct source langauge instance for this parser.

Specified by:
getSourceLanguage in class Parser

genTemp

protected VariableDecl genTemp(Type t)
Create a new temporary variable for use by the optimized code.


parse

public CallGraph parse(java.lang.String name,
                       Suite suite,
                       Vector<java.lang.String> macroText)
Parse the specified Fortran file. If macroText is not null, the set of defined macros is added to it.

Specified by:
parse in class Parser
Parameters:
name - the name of the Clef AST (i.e., the file name)
suite - is the collection of call graphs
macroText - is null or has macro definitions as text added
Returns:
new CallGraph

getStringLength

protected int getStringLength(Type type)
Return the Fortran CHARACTER type length or -1 if it is not a Fortran CHARACTER type.


setColumn

public final void setColumn(int column)
Set the source line scan position.

See Also:
Keywords

callback

public void callback(int callback,
                     Expression exp,
                     BlockStmt bs)
              throws InvalidException
Called by ImpliedDo to generate code for implied-do loops.

Throws:
InvalidException