Description

Expressions specify that zero or more operations are to be performed on a group of operands (also known as factors), in such a way as to result in a single value of a particular type. If the number of operations specified by an expression is zero, then the expression must consist of a single operand, and the value of the expression is the value of the operand. The process of obtaining the value of an expression, by obtaining the values of its operands and performing any specified operations, is called evaluating the expression. The operations to be performed by an expression are specified using operators.

Example

Here are some examples of expressions:

``````   3+5      which results in the integer value 8
true     which results in the boolean value true
3+5.0    which results in the real value 8.0
1+2*3    which results in the integer value 7
(1+2)*3  which results in the integer value 9``````

Syntax

(NOTE: for clarity some parts of the syntax are omitted, see Irie Pascal Grammar for the full syntax):

``````   expression = shift-expression [ relational-operator shift-expression ]

adding-operator = '+' | '-' | 'or' | 'or_else' | 'xor'

factor = [ sign ] unsigned-constant |
[ sign ] variable-access |
[ sign ] '(' expression ')' |
[ sign ] function-designator |
[ sign ] function-method-designator |
[ sign ] 'not' factor |
set-constructor

multiplying-operator = '*' | '/' | 'div' | 'mod' | 'and' | 'and_then'

relational-operator = '=' | '<>' | '<' | '<=' | '>' | '>=' | 'in'

shift-expression = simple-expression [ shift-operator simple-expression ]

shift-operator = 'shl' | 'shr'

sign = '-' | '+'

simple-expression = term { adding-operator term }

term = factor { multiplying-operator factor }``````