Algebraic Expression
An algebraic expression can contain variable identifiers, numbers, arithmetic operators, and built-in functions and constants, according to the usual rules of algebra.
Formally, the grammar of an algebraic expression is as follows:
Clause | Grammar |
---|---|
exp2: | exp1 [ [op2] exp2 ]* |
exp1: | [op1]* exp0 |
exp0: | `(' exp `)' | variable | number | const |
op2: | binary arithmetic operator |
op1: | unary operator or built-in function |
const: | numerical constant reserved word |
number: | integer, floating point, exponential, or mu:su:pu notation |
variable: | user-defined variable identifier |
[ …] denotes an optional clause
* means zero or more clauses
| separates alternatives quotes
`…' denote a literal character.)
Fractional clauses are valid in algebraic expressions. A fractional clause has the following grammar:
`#' integer `/' integer `#' (example: #2 1/2#)
In number clauses, distances and coordinates can be expressed in working units (MU:SU:PU:), decimal, or fractional notation.
The multiplication operator * is not assumed. Omitting an operator is a grammatical error.