Next: , Previous: , Up: Optimizer Idiom Language   [Index]


C.3 OIL Expressions

An OIL expression is built around subexpressions connected by infix binary operators and/or preceded by prefix unary operators, the same way as in C or INTERCAL (although unary operators must be entirely before their argument; the one character later position is not allowed.) As in INTERCAL, there is no operator precedence; expressions must be very fully bracketed to show unambiguously what the precedences must be, and then more so; for instance, bracketing marks must be placed around the argument of a unary operator in most circumstances. Bracketing of expressions can be done with parentheses, sparks (apostrophes) or rabbit-ears (double-quotes).

The following unary and binary operators are allowed in OIL expressions:

$ INTERCAL mingle
~ INTERCAL select
&16 INTERCAL unary AND (16-bit)
V16 INTERCAL unary OR (16-bit)
?16 INTERCAL unary XOR (16-bit)
^16 INTERCAL unary sharkfin (16-bit)
@16 INTERCAL unary whirlpool (16-bit)
@216..@516 INTERCAL unary generalised whirlpool (16-bit)
&32 INTERCAL unary AND (32-bit)
V32 INTERCAL unary OR (32-bit)
?32 INTERCAL unary XOR (32-bit)
^32 INTERCAL unary sharkfin (32-bit)
@32 INTERCAL unary whirlpool (32-bit)
@232..@532 INTERCAL unary generalised whirlpool (32-bit)
& C binary bitwise AND
| C binary bitwise OR
^ C binary bitwise XOR
+ C addition
- C subtraction
* C multiplication
/ C integer division
% C modulus
> C greater than
< C less than
~ C unary bitwise complement
!= C not equals operator
== C equals operator
&& C logical AND
|| C logical OR
>> C bitwise rightshift
<< C bitwise leftshift
! C unary logical NOT

(Note that in some cases two operators are expressed the same way, but that this doesn’t matter because one is unary and the other is binary so that there can’t be any ambiguity, only confusion. Also note that unlike INTERCAL unary logic operators, OIL unary logic operators must have a bitwidth stated.)

It hasn’t yet been explained what operands these operators have to operate on; the syntax for those depends on whether it’s a pattern or replacement that the expression is representing.


Next: , Previous: , Up: Optimizer Idiom Language   [Index]