next up previous contents
Next: 3.1.9 Functions Up: 3.1 Basic Facilities Previous: 3.1.7.3 Type Conversions


3.1.8 Operators

Operators available for writing MDL expressions are listed in Table 3.4. Operators with the same precedence are listed with equal priority numbers. Operators with higher priority numbers have higher precedence than operators with lower ones.

The syntax and precedence of the expressions is independent from the actual type of the involved values. For the built-in types the grammar rules are fully compatible to the corresponding rules of the ANSI C++ standard [1].

In this table expr is an expression resulting in an MDL value of the required type. Two different flavors of MDL values can be distinguished: MDL values which can be altered by operators, such as parameters, or the results of the preincrement or predecrement operators will be denoted as lval_expr. Values which can not be altered or assigned to, for instance the result of the binary + operator, will be labeled as rval_expr. An expr can be either an lval_expr or an rval_expr. name denotes the name of a certain parameter and instance is the instance name of an MDL class object.


Table 3.4: MDL operators
Operator Result Syntax Priority
interface scope lval_expr :name 16
global scope lval_expr ::name 16
member selection lval_expr instance.name 15
function call rval_expr expr (expr), expr (expr, expr) 15
array subscripting lval_expr expr [ expr ] 14
post increment lval_expr expr ++ 14
post decrement lval_expr expr - 14
preincrement lval_expr ++ lval_expr 13
predecrement lval_expr - lval_expr 13
unary minus lval_expr - expr 13
unary plus lval_expr + expr 13
not lval_expr lval_expr 12
multiply rval_expr expr * expr 11
divide rval_expr expr / expr 11
modulo (remainder) rval_expr expr % expr 11
add rval_expr expr + expr 10
subtract rval_expr expr - expr 10
shift left rval_expr expr << expr 9
shift right rval_expr expr >> expr 9
less than rval_expr expr < expr 8
less than or equal rval_expr expr <= expr 8
greater than rval_expr expr > expr 8
greater than or equal rval_expr expr >= expr 8
equal rval_expr expr == expr 7
not equal rval_expr expr != expr 7
bitwise AND rval_expr expr & expr 6
bitwise exclusive OR rval_expr expr $\hat{~}$ expr 5
bitwise inclusive OR rval_expr expr | expr 4
logical AND rval_expr expr && expr 3
logical inclusive OR rval_expr expr || expr 2
simple assignment lval_expr expr = expr 1
multiply and assign lval_expr expr *= expr 1
divide and assign lval_expr expr /= expr 1
remainder and assign lval_expr expr %= expr 1
add and assign lval_expr expr += expr 1
subtract and assign lval_expr expr -= expr 1
shift left and assign lval_expr expr <<= expr 1
shift right and assign lval_expr expr >>= expr 1
AND and assign lval_expr expr &= expr 1
inclusive OR and assign lval_expr expr |= expr 1
exclusive OR and assign lval_expr expr $\hat{~}$= expr 1


next up previous contents
Next: 3.1.9 Functions Up: 3.1 Basic Facilities Previous: 3.1.7.3 Type Conversions
Robert Mlekus
1999-11-14