Bare-bones Fortran is our most universal computer language for computational physics. For general programming, however, it has been surpassed by C. ``Ratfor" is Fortran with C-like syntax. I believe Ratfor is the best available expository language for mathematical algorithms. Ratfor was invented by the people who invented C. Ratfor programs are converted to Fortran with the Ratfor preprocessor. Since the preprocessor is publicly available, Ratfor is practically as universal as Fortran.
You will not really need the Ratfor preprocessor or any precise definitions if you already know Fortran or almost any other computer language, because then the Ratfor language will be easy to understand. Statements on a line may be separated by ``;". Statements may be grouped together with braces { }. Do loops do not require statement numbers because { } defines the range. Given that if( ) is true, the statements in the following { } are done. else{ } does what you expect. We may not contract else if to elseif. We may always omit the braces { } when they contain only one statement. break will cause premature termination of the enclosing { }. break 2 escapes from {{ }}. while( ) { } repeats the statements in { } while the condition ( ) is true. repeat { ... } until( ) is a loop that tests at the bottom. A looping statement more general than do is for(initialize; condition; reinitialize) { }. An example of one equivalent to do i=0,n-1 is the looping statement for(i=0;i<n;i=i+i). The statement next causes skipping to the end of any loop and a retrial of the test condition. next is rarely used, but when it is, we must beware of an inconsistency between Fortran and C-language. Where Ratfor uses next, the C-language uses continue (which in Ratfor and Fortran is merely a place holder for labels). The Fortran relational operators .gt., .ge., .ne., etc. may be written >, >=, !=, etc. The logical operators .and. and .or. may be written & and |. Anything from a # to the end of the line is a comment. Anything that does not make sense to the Ratfor preprocessor, such as Fortran input-output, is passed through without change. (Ratfor has a switch statement but we never use it because it conflicts with the implicit undefined declaration. Anybody want to help us fix the switch in public domain Ratfor?)
Indentation in Ratfor is used for readability. It is not part of the Ratfor language. Choose your own style. I have overcondensed. There are two pitfalls associated with indentation. The beginner's pitfall is to assume that a do loop ends where the indentation ends. The loop ends after the first statement. A larger scope for the do loop is made by enclosing multiple statements in braces. The other pitfall arises in any construction like if() ... if() ... else. The else goes with the last if() regardless of indentation. If you want the else with the earlier if(), you must use braces like if() { if() ... } else ....
The most serious limitation of Fortran-77 is its lack of ability to allocate temporary memory. I have written a preprocessor to Ratfor or Fortran to overcome this memory-allocation limitation. This program, named sat, allows subroutines to include the declaration temporary real data(n1,n2), so that memory is allocated during execution of the subroutine where the declaration is written. Fortran-77 forces us to accomplish something like this More recently Bob Clapp has prepared Ratfor90, a Perl-based preprocessor to Fortran 90 that incorporates the desireable features of both ratfor and Fortran 90 and is backward compatible to the codes of this book.