Arithmetic
Syntax
exp = "IF" conjunct "THEN" exp "ELSE" exp;
sum = term (
'+ sum /
'- sum /
-empty);
term = factor (
'* term /
'/ term /
'(up arrow symbol) term /
.empty);
factor = '- factor / bitop;
bitop = compliment (
'/' bitop /
'/'\ bitop /
'& bitop / (
.empty);
compliment = "--" primary / primary;
(symbol for up arrow) means mod. and /\ means exclusive or.
Notice that the uniary minus is allowable, and parsed so you can write x*-y.
Since there is no standard convention with bitwise operators, they all have the same precedence, and parentheses must be used for grouping.
Compliment is the l's compliment.
It is assumed that all arithmetic and bit operations take place in the mode and style of the machine running the code. Anyone who takes advantage of word lengths, two's compliment arithmetic, etc. will eventually have problems.