Bookshelf Home | Contents | Index | PDF

All rules in the Rule Assembly Language (RAL) consist of expressions. Expressions consist of an operator and its operands. The number and type of operands depend on the operator. All expressions have the following form:

`operator``(``A``,``B``...)`

For example, the following expression evaluates to the sum of A plus B.

`+(``A``,``B``)`

Most operators allow their operands to be expressions. In the expression above, both A and B can themselves be expressions.

Spaces, tabs, and new-lines are ignored in expressions.

In Rule Assembly Language, a rule is a list of one or more top-level expressions. A top-level expression is the top-level operator and its associated operands in RAL statements. Rules are constraints.

For example, in the following statement, `+(``A,B``)` is a sub-expression and is not a top-level expression. The top-level expression is "`==`" and its operands. So the rule or constraint on all solutions is that the sum of the quantities of A and B must equal the quantity of C in all solutions.

==(+(A,B),C)

A sub-expression is an expression that functions as an operand. Depending on the operator, a sub-expression returns a quantity or a logical true or false. The sub-expression itself is not a rule or constraint.