. EXPRESSIONS
This file is a list of Prolog structures which are interpretted by some
predicates as operations in integer arithmetic. Even when not interpretted
and evalkuated - they are parsed and stored in a tree structure using the
priorities of normal arithmetic.
On the right hand side of the 'is' infix operator and on BOTH sides of the
following comparisons: < <= =:= =/= >= > some structures are evaluated using
aritmetic. The structures that are acceptable are
prefix_arithmetic::="+"|"-".
multiplier::="*"|"/"|"mod".
adder::="+" | "-".
expression::=multiplicative #( adder multiplicative), -- only in some contexts!
multiplicative::=#prefix_arithmetic simple_expression #(multiplier simple_expression).
simple_expression::=integer | variable_with_numeric_instance| "(" expression ")".
Notice that an expression will fail to evaluate if any variable in it is
not instanciated to an integer:
X = 1, Y=2, Z is X+Y?
will succeed with Z=3, but
X = 1, Y=a, Z is X+Y?
X = 1, Z is X+Y?
both fail. Similarly we can not use
X > 1, X < 10, print X?
to generate X values between 1 and 10 because the comparisons need values
on both sides.
Current research has added the abillity to solve sets of inequalities and
generate solutions to Prolog.
+ A ::= `Plus - only evaluated on left hand of 'is' and in numerical comparisons`.
- A ::=`- minus - only evaluated on left hand of 'is' and in numerical comparisons`.
A * B ::=`- Multiply - only evaluated on left hand of 'is' and in numerical comparisons`.
A + B ::=`- Add - only evaluated on left hand of 'is' and in numerical comparisons`.
A - B ::=`- Subtract - only evaluated on left hand of 'is' and in numerical comparisons`.
A / B ::=`- Divide - only evaluated on left hand of 'is' and in numerical comparisons`.
A mod B ::=`- Modulus/remainder - only evaluated on left hand of 'is' and in numerical comparisons`.