Infix, prefix, postfix and Mixfix operators are different ways to write expressions equally.
Infix Notation
Operators are written in the middle of the operands
Examples
(6-5)*7
A*B + C/D
Prefix Notation
Also knowns as Polish notion. Operators are placed in the left of the operands
Examples
*(- 6 5) 7
or* - 6 5 7
+ * A B / C D
Postfix Notation
Also knowns as Reverse Polish notion. Operators are placed in the right of the operands
Examples
6 5 - 7 *
A B * C D / +
Outfix Notation
Operators are placed out of the operands
Examples
|_|
in Maude, e.g.| 1 0 1 1 0 |
is 5
Mixfix Notation
Have several name parts and can be infix, postfix, prefix, and closed (a).
References
Examples
if n + n == n ! then n else (n + n - n)
in Agda: several name parts, mixed fixity (prefix, infix, postfix)L ? S : T
in Maude: comination of outfix and infix
Definition
- Holes: denoted by
_
in_[_]
- Precedence
- Infix
_ + _
: two holes and one name part+
- Prefix
if _ then _ else _
: three name parts (if, then, else), and three holes.