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 inconsistancy 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. This should be remedied in Fortran-8x. The ``x'' in 8x refers, unfortunately, to the year in the 1980s that the language was intended to become available. Now it is officially called Fortran 90, though I call it Fortran 9x since in 1994 it is still not on any of our workstations. Meanwhile, with Biondo Biondi and Dave Nichols, I have written a preprocessor to Ratfor or Fortran to overcome Fortran's 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 only with predetermined constants or parameters. If the sat preprocessor is not available on your system, you can modify the subroutines in this book by putting the appropriate numerical constants into the memory arrays being allocated, and that should suffice until the better days ahead.