If an operator has multiple operands, the order of evaluation is unspecified except when stated otherwise. The precedence and associativity of the operators are listed in Table 2.
expression |
( expression![]() |
Yields expression.
expression
must be of any type.
expression is of the same type, and may be used as lvalue if
expression
may be used as lvalue.
expression |
integer_constant |
expression |
character_constant |
expression |
real_constant |
expression |
true ![]() |
expression |
string_constant |
expression |
null |
Any constant is an expression, as defined in Sect. 2.
expression |
identifier |
An identifier can be used as expression. identifier must be visible in the current scope. The type of expression depends on the declaration of identifier. If it is declared as variable, the type is given by its declaration, and expression can be used as lvalue. If it is declared as subprogram, the type is of the implicit subprogram type; the only way to use it is in a subprogram invocation; it cannot be used as lvalue then.
expression |
new array [
expression![]() |
The new operator yields a reference to newly allocated heap space for
an array.
expression must be of type int.
expression
indicates the size (number of elements) of
the array; a runtime error occurs if this value is negative.
All elements in the array are initialized according to
Table 1.
The type of expression is array of
type; it may not be used as lvalue.
expression |
expression![]() ![]() |
Indexes expression with index value
expression
.
The type of expression
must be an array of any type,
expression
must be of type int.
A runtime error occurs if expression
is a null reference, or
if not 0
expression
size of expression
.
The type of expression is the base type of
expression
and may be used as lvalue.
expression |
expression![]() |
argument_list |
expression [ ,
argument_list![]() |
Invokes the subprogram expression.
expression
must be a procedure or function.
If expression
is a procedure, expression has
no value, and may not be used as subexpression.
If expression
is a function, expression has
the value of the result of invoking expression
; its type
becomes the return type of the invoked function; it may not be used as lvalue.
The actual argument list must match the formal parameter list, as defined below. The number of actual arguments must be the same as the number of formal parameters. If the formal parameter corresponding to an actual argument is not a var parameter, the type of the actual argument must be assignment compatible with the type of the formal parameter; call by value semantics is used for argument passing. If the formal parameter corresponding to an actual argument is a var parameter, the type of the actual argument must be exactly the same as the type of the formal parameter; the actual argument must be an lvalue; and call by reference semantics is used for argument passing.
expression |
not expression![]() |
Yields the logical negation of expression.
expression
must be of type bool.
expression is of type bool, and may not be used as lvalue.
expression |
size of expression![]() |
Yields the number of elements in expression.
expression
must be an array of any type.
A runtime error occurs if expression
is a null reference.
expression is of type int, and may not be used as lvalue.
expression |
![]() ![]() |
Yields the result of subtracting expression from 0 or 0.0.
expression
must be of type int or real.
expression is of the same type, and may not be used as lvalue.
expression |
+ expression![]() |
Yields expression.
expression
must be of type int or real.
expression is of the same type, and may not be used as lvalue.
expression |
expression![]() ![]() |
Yields the product of expression and
expression
.
expression
and expression
must be both of
type int or both of type real.
expression is of the same type, and may not be used as lvalue.
expression |
expression![]() ![]() |
Yields the quotient of expression and
expression
.
expression
and expression
must be both of
type int or both of type real.
expression is of the same type, and may not be used as lvalue.
expression |
expression![]() ![]() ![]() |
Yields the difference between expression and
expression
.
expression
and expression
must be both of
type int or both of type real.
expression is of the same type, and may not be used as lvalue.
expression |
expression![]() ![]() |
Yields the sum of expression and
expression
.
expression
and expression
must be both of
type int or both of type real.
expression is of the same type, and may not be used as lvalue.
expression |
expression![]() ![]() ![]() |
Yields true if expression is smaller than
expression
.
is non-associative, thus e
e
e
results in an error.
expression
and expression
must be both of
type char, both of type int, or both of type real.
expression is of type bool, and may not be used as lvalue.
expression |
expression![]() ![]() ![]() |
Yields true if expression is smaller than or equal to
expression
.
is non-associative, thus e
e
e
results in an error.
expression
and expression
must be both of
type char, both of type int, or both of type real.
expression is of type bool, and may not be used as lvalue.
expression |
expression![]() ![]() ![]() |
Yields true if expression is greater than
expression
.
is non-associative, thus e
e
e
results in an error.
expression
and expression
must be both of
type char, both of type int, or both of type real.
expression is of type bool, and may not be used as lvalue.
expression |
expression![]() ![]() ![]() |
Yields true if expression is greater than or equal to
expression
.
is non-associative, thus e
e
e
results in an error.
expression
and expression
must be both of
type char, both of type int, or both of type real.
expression is of type bool, and may not be used as lvalue.
expression |
expression![]() ![]() ![]() |
Yields true if expression is equal to
expression
.
expression
and expression
must be both of
type bool, both of type char, both of type int, both of
type real;
or one of the operands is an array
of any type and the other is either an array
of compatible base type or null.
Two arrays are equal if the references are equal.
expression is of type bool, and may not be used as lvalue.
expression |
expression![]() ![]() ![]() |
Is equivalent with not ( expression
expression
).
expression |
expression![]() ![]() |
Yields false if expression evaluates to false,
or if expression
evaluates to false.
If expression
evaluates to false,
expression
is not evaluated.
expression
and expression
must be both of
type bool.
expression is of type bool, and may not be used as lvalue.
expression |
expression![]() ![]() |
Yields true if expression evaluates to true,
or if expression
evaluates to true.
If expression
evaluates to true,
expression
is not evaluated.
expression
and expression
must be both of
type bool.
expression is of type bool, and may not be used as lvalue.
K.G. Langendoen 2010-01-08