Basic Operation of Plato
Basic Operation of Plato
• A statement consists of zero or more key words, symbolic names, literal constants,
statement labels, operators, and special characters.
• Each key word, symbolic name, literal constant, and operator consists of one or more
characters from the FORTRAN character set.
IF(PRES.LT.SFCPRS) GO TO 1
IF (PRES .LT. SFCPRS) GO TO 1
Elements of FORTRAN: Symbolic Names
• In general, for any single program unit, different entities cannot have the same symbolic name.
• Throughout any program of more than one programming unit, no two of the following can have the same name:
Block data subprograms
Common blocks
Entry points
Function subprograms
Main program
Subroutines
Elements of FORTRAN: Programs and Statements
• Program
A program unit is a sequence of statements, terminated by an END statement. Every program unit is either a main
program or a subprogram. If a program is to be executable, it must have a main program.There are three types of
subprograms: subroutines, functions, and block data subprograms. The subroutines and functions are called procedures,
which are invoked from other procedures or from the main program. The block data subprograms are handled by the
loader.
• Statements
A statement consists of one or more key words, symbolic names, literal constants, and operators, with appropriate
punctuation. In FORTRAN, no keywords are reserved in all contexts. Most statements begin with a keyword; the
exceptions are the statement function and assignment statements.
• Executable or Nonexecutable Statements
Every statement is either executable or nonexecutable. In general, if a statement specifies an action to be taken at
runtime, it is executable. Otherwise, it is nonexecutable.The nonexecutable statements specify attributes, such as type
and size; determine arrangement or order; define initial data values; specify editing instructions; define statement
functions; classify program units; and define entry points. In general, nonexecutable statements are completed before
execution of the first executable statement.
Elements of FORTRAN: Fortran Statements
GOD is REAL
… unless you specify it as an integer!
CONSTANTS
• CHARACTER: ‘FILEN’
• INTEGER: 3, -9999, 1e10
• Must be in the range (-2147483648, 2147483647).
• REAL: 3.3, -9999., 1.5e8, 1e-3
• Must be in the range (1.175494E-38, 3.402823E+38)
• Real*8: 6D2, -25.3D-7
• Must be in the range (2.225074D-308, 1.797693D+308)
• Real*16: 6Q2, -25.3Q-7
• Must be in the range (3.362Q-4932, 1.20Q+4932)
• COMPLEX: (1,-2) or (1.3,0.4)
• LOGICAL: .TRUE. and .FALSE.
Variables & Arrays
• Arrays: Examples:
• DIMENSION LEVEL(10), T(72,73)
• REAL CORR(-3:3)
• In this case, CORR has 7 elements, with CORR(0)
being the 4 th element.
Expressions
• Arythmetic operators:
• ** Exponentiation
• * Multiplication
• / Division
• + Addition or Unary Plus
• -Subtraction or Unary Minus
• Precedence from left to right: 1) **, 2) *, /, 3) +, -, except when parenthesis
are involved
Expressions
• Character operators:
• // Concatenation:
• a//b, where a, b are characters, or ‘file’//’name’
• Logical operators:
• X.AND.Y Conjunction: Both X & Y are true
• X.OR.Y Disjunction: Either X or Y or both are True.
• …
• Relational operators:
• .LT. Less than
• .LE. Less than or equal
• .EQ. Equal
• .NE. Not equal
• .GT. Greater than
• .GE. Greater than or equal
Expressions