Expressions
- Last UpdatedJan 26, 2023
- 1 minute read
An expression is a formula that defines the computation of a value. The syntax of a general expression is explained below:
|
<range_expression> |
:= <expression> [:<expression>[::<expression>]] |
|||
|
<expression> |
:=<relation> {AND <relation>} |<relation> {OR <relation>} | <relation> {XOR <relation>} |
|||
|
<relation> |
::=<simple_expression> [<relational_operator><simple_expression>] |
|||
|
<relational_operator> |
::= == | /= | < | <= | > | >= |
|||
|
<simple_expression> |
:= [unary_operator] <term> {adding_operator} <term> |
|||
|
<adding_operator> |
:= + | - | & |
|||
|
<unary_operator> |
:= + | - | NOT |
|||
|
<term> |
:=<factor> {<multiplying_operator> <factor>} |
|||
|
<multiplying_operator> |
:= * | % |
|||
|
<factor> |
:= <primary> [** <factor>] |
|||
|
<primary>:= |
<decimal> |
| <integer> |
||
|
| <variable> |
| <internal_function> |
|||
|
| (<expression>) |
| <string> |
|||
|
| <boolean> |
||||
|
<internal_function> |
:= <function_name>(<expression>) |
|||
|
<variable> |
::= <local_variable> |
|||
Each primary has a value and a type. The type of an expression depends only on the type of its constituents and on the operators applied. The rules defining the allowed operand types and the corresponding result types are given below.