General Definitions

Digraphs

A digraph is a two-character code composed of a dollar character $ followed by any other character. The purpose of the digraph is two-fold.

  1. To instruct the preprocessor to perform certain functions. The $#, $), $(, $L, $R, $P and $B digraphs are in this category. These are discussed further in the the section called “Special character controls ”section.

  2. To 'protect' certain characters from their usual interpretation in the language. For example $> protects the > from being interpreted as 'greater than' and thus enables the symbol > to be output in Fortran. The $ character is in effect 'stripped off' the digraph just prior to output. All digraph combinations except those listed in point 1. are in this category. Digraph protection is not required within apostrophe strings or chardata: macros.

Special functions

Some characters are used to perform special functions in the ratmac language and RFPP preprocessor. These characters will perform these functions unless enclosed in an apostrophe string or preceded by a $. They are:

  • # signals end of active code on a line (also used internally for this purpose)

  • ; signals end of an expression but not end of a line

  • : signals end of a macro name

  • ^ is converted to : on output

  • ' character string delimiter (apostrophe string)

  • " character string delimiter (quote string)

  • [ macro definition delimiter (see the section called “Defining Macros”)

  • ] macro definition delimiter

  • $ signals start of two-character digraph code

Relational operators

The following characters are used as relational operators in the ratmac language, except if contained in an apostrophe string or a the section called “chardata:, realdata: etc.”, or preceded by the digraph character $. The Fortran 'dot' relational operators (i.e. .NOT., etc.) may also be used but will be converted to the symbolic form by RFT unless contained within an apostrophe string or square brackets.

  • > is 'greater than'

  • < is 'less than'

  • ! is 'not'

  • & is 'and'

  • \\ is 'or'

  • == is 'equal to'

  • >= is 'greater than or equal to'

  • <= is 'less than or equal to'

  • != is 'not equal to'

RFPP character set

The minimum character set required for the preprocessing of ratmac is

  • digit 0123456789

  • alphabetic ABCDEFGHIJKLMNOPQRSTUVWXYZ arithmetic + - * /

  • punctuation , . ; :

  • delimiter ( ) [ ] ' "

  • relational = > < ! & \\

  • special # $ % @ ? ^ _ space

The printed form of some of the special characters will vary from machine to machine. However the internal representations of these characters will remain consistent. Note that RFPP accepts any character, but requires the above set for correct execution of its instruction set. Lower-case characters (a to z) are automatically converted to upper-case unless inside an apostrophe string. Note also that the sharp (#) character may only be used actively inside an apostrophe string because it is used internally by RFPP as the end-of-line marker.

Statement blocks

A statement block is one or more lines of ratmac code executed by a single command. If the statement block is more than one line, it must be surrounded by open and close braces $( and $). For example:

command
$(
statement-block
$)

If there is only one line of code, the open and close braces may be omitted. For example:

command
single-line-statement

or

command single-line-statement# except for the DO command!

Line delimiters

Ratmac lines may be ended in several ways. An expression may be delimited with a carriage return or # or ; or $( or $). For example, the following expressions are equivalent:

expression1
expression2
expression3

or

expression1# 		    a comment can go here!
expression2; expression3# 	    or here!

or

expression1; expression2; expression3#

Line extenders

Multi-line expressions may be concatenated in ratmac using the digraph $# or a comma ,#. Lines ending in these symbols are 'extended' into the next line. For example:

line1$# 	this is a continuation digraph
line2

is treated as line1line2

line1,# 	note the comma on this line
line2$#
line3

becomes

line1,line2line3

Character strings

Character strings are delimited by an apostrophe ' or a quote ". Character strings are output by RFPP enclosed by apostrophes ' (i.e. " is converted to ' for output).

For example,

'This is a string 123*!' and "This is also a string"

Note that in both string types the 'case' of the characters is not changed and the blanks in the string are preserved by RFPP and RFT. Apostrophe strings are processed by RFPP differently to quote strings. An apostrophe string is treated as a single entity and the string contents are not evaluated. In contrast a quote string is treated similarly to a non-string expression. An apostrophe string may not exceed one line, while a quote string continues until the balancing quote is found. For example, this quote string is the same as the last example.

"This is $# 			the '$#' is the line extension indicator
also a string"

The definition and application of character strings is considered futher under the the section called “chardata:, realdata: etc.”.