The MDB language adheres to the same syntax as the adb language, in order to provide compatibility for legacy macros and script files. New MDB dcmds use the extended form ::name, in order to distinguish them from legacy commands that are prefixed with either : or $. Expressions can also be evaluated on the right-hand side of a dcmd name by enclosing them in square brackets preceded by a dollar sign ($[ ]). Similar to adb, an input line that begins with an exclamation mark (!) indicates that the command line should be executed by the user's shell. In MDB, a debugger command may also be suffixed with an exclamation mark to indicate that its output should be piped to the shell command following the exclamation mark.
In adb, binary operators are left associative and have lower precedence than unary operators. Binary operators are evaluated in strict left-to-right order on the input line. In MDB, binary operators are left associative and have lower precedence than unary operators, but the binary operators operate in order of precedence according to the table in Binary Operators in MDB. The operators conform to the order of precedence in ANSI C. Legacy adb macro files that do not explicitly parenthesize ambiguous expressions may need to be updated to work with MDB. For example, in adb the following command evaluates to the integer value nine:
$ echo "4-1*3=X" | adb 9
In MDB, as in ANSI C, operator * has higher precedence than - and therefore the result is the integer value one:
$ echo "4-1*3=X" | mdb 1