The term expression is reserved for arithmetic expressions. Coral 66 has no designational expressions of Algol 60 type. As there are no Boolean variables and no bracketed Boolean expressions (see Section 6.2.1), the expressions after IF are known as conditions. The syntax for expressions is
Strings are defined in Section 10.4.
Arithmetic is performed with the monadic and dyadic adding operators + and -, and with the dyadic multiplying operators * (multiply) and / (divide). The plus and minus operators work on terms, which are combinations of factors joined by multiplication or division. There is no exponentiation operator. The syntax for simple expression begins as follows
Simpleexpression Addoperator Term
Term Multoperator Factor
Primaries are the basic operands in expressions. For example in the analysis of the expression
we discover three terms, the primary x, the term y * (a + b) and the primary 4. The middle term is the product of two factors, the primary y and the primary (a + b). To complete the analysis, all expressions from within brackets are similarly analyzed until no further reduction is possible an no expression brackets remain. When an expression contains no word-logical operators (see Section 126.96.36.199), a factor must be a primary, which may or may not be of a defined type. Thus,
Untyped primaries are those operands which cannot be classed as integer, floating-point or fixed-point (of known scale) without reference to their context. For example, the number 3.1416 may be represented, with varying degrees of accuracy, in may different ways within a computer word. The same applies to an expression, whose type is determined by context (see Section 6.1.3).
( Expression )
A "real" (see Section 10.2) is an unsigned numerical constant containing a decimal or octal point or a tens exponent.
Typed primaries are classified as follows
LOCATION ( Wordreference )
Numbertype ( Expression )
A simple reference, or a reference to an array element or whole-word table-element, has a type defined in its declaration. Such references may be described as word references because they refer to items of data for which whole computer words are set aside. A further kind of word reference, the anonymous reference, takes the form
where the index is any expression evaluated to an integer to give the actual location of a computer word. An anonymous reference possesses all the properties of an identified reference, except that it lacks an identifier. Just as a variable i, declared as INTEGER i, may be used in an expression to refer to the contents of the computer word allocated to i, so the use of an anonymous reference in an expression will refer to the contents of the address defined by Index. Such contents are taken to be of numeric type INTEGER, irrespective of any type declaration which may have been associated with that word with some other type. See also Section 188.8.131.52.3. The syntax for a word reference is
Id [ Index ]
Id [ Index , Index]
Any single item of packed data may act as a typed primary. Such an item is either
a reference to a part-word table-element, or
a specified field of any typed primary.
In case (a), the type is defined in the table declaration. In case (b), the desired field is selected by a prefix of the form
in front of the primary to be operated upon. The result of this operation is a positive integer value of width Totalbits and in units of the bit at Bitposition. The value will in general be implementation-dependent, even though the operand must be typed, as no conventions are laid down for the internal representation of floating-point or fixed-point items of data. In all cases, however, the numeric type resulting from the application if BITS is INTEGER. The syntax for a part-word, which should be distinguished from that of a part-word reference (see Section 7.1), is
Id [ Index ]
BITS [ Totalbits , Bitposition] Typedprimary
The computer location of any word reference is obtainable by the location operator which is written in the form
and has the value of type INTEGER. It may be notes that if i and j refer to integers, [LOCATION(i)] is equivalent to i, and LOCATION([j]) is equivalent to j. The reasoning is as follows. LOCATION(i) is the address of the computer word allocated to i. Enclosure in square brackets forms an entity equivalent to an identifier standing for this address, which by hypothesis is i. Similarly,  is equivalent to an identifier for the address 23, and LOCATION() is the address for which this fictitious identifier stands, which is 23 by hypothesis.
A typed primary may have its type changed, and an untyped primary may be typed, by enclosure within round brackets preceded by a specific Numbertype as described in Section 6.1.3.
Three dyadic logical operators are defined for use between typed primaries. The effect of these operators is implementation-dependent to the extent that the word-representation of data is not defined by the language. The ith bit of the result is a given logical function of the ith bits of the two operands, and the result as a whole has the numeric type INTEGER. To avoid confusion with Boolean operators in conditions (see Section 6.2.1), a different terminology is used. The operators are
DIFFER UNION MASK 0 1 0 1 0 1 ----- ----- ----- 0|0 1 0|0 1 0|0 0 1|1 0 1|1 1 1|0 1
DIFFER is recognizable as "not equivalent", UNION as "inclusive or" and MASK as "and". The operators are shown in order of increasing tightness of binding. As bracketed expressions are untyped, the use of brackets to overcome binding priorities entails explicit integer scaling. For example
The formal syntax continued from Section 6.1.1, is
Booleanword4 DIFFER Booleanword5
Booleanword5 UNION Booleanword6
Booleanword6 MASK Typedprimary
Expressions are used in assignment statements, as value parameters of procedures and as integer indexes, all of which contexts determine the numeric type finally required. Coral 66 expressions are automatically evaluated to this type, but in the process of calculation, data may be subjected by the compiler to various intermediate transformations. Although an algorithm for evaluating expressions does not form part of the official definition of the language, all syntactically outermost terms in an expression will be evaluated to the required numeric type before the adding operators are applied. In the simplest cases, this rule ensures predictable results, though it should be particularly noted that rounding-off errors will not be minimal, and overflow may occur. If an expression is enclosed in round brackets, its terms are not "outermost", the rule no longer applies, and the algorithm for the particular compiler determines the sequence of events. The programmer can impose any desired system of evaluation by the use of Numbertype(Expression), which is a typed primary (see Section 184.108.40.206), any occurrence of which behaves like a variable, ref (say), declared as
and assigned a value by
before it is used. For example, if i and j are integer references and x is a floating-point reference, the assignment statement
causes i and j to be converted to floating-point before the subtraction, whilst
causes subtraction of integers before conversion to floating point. Although the order of evaluation of expression is undefined, the following rule concerning functions will apply. Value parameters of a function are necessarily evaluated before the function itself is computed, so that the order of evaluation of sin(cos(expn)) will be expn, cos, sin. Apart from this type of reversal, functions occurring in a simple expression will be evaluated in the order in which they appear when the expression is read from left to right, regardless of brackets.
It is assumed that Totalbits will not be set equal to the full word length