101 lines
3.7 KiB
Plaintext
101 lines
3.7 KiB
Plaintext
Precedence level and associativity of operators
|
|
|
|
The following table lists the precedence level of all operator classes
|
|
from the highest to the lowest precedence. A few other syntactic constructions
|
|
are also listed as references.
|
|
|
|
{%latex:
|
|
%
|
|
% Note: the tables below should be kept in sync with the one in
|
|
% manual/manual/refman/expr.etex .
|
|
%
|
|
\begin{tabular}{cc}
|
|
\hline
|
|
Operator class & Associativity \\
|
|
\hline
|
|
$!\ldots$ $\tilde{}\ldots$ & -- \\
|
|
$.\cdots()$ $.\cdots[]$ $.\cdots\\{\\}$ & -- \\
|
|
\#\ldots & left \\
|
|
function application & left \\
|
|
- -. & -- \\
|
|
$**\ldots$ lsl lsr asr & right \\
|
|
$*\ldots$ /\ldots \%\ldots mod land lor lxor & left \\
|
|
+\ldots -\ldots & left \\
|
|
:: & right \\
|
|
@\ldots \textasciicircum\ldots & right \\
|
|
=\ldots <\ldots >\ldots |\ldots \&\ldots \$\ldots != & left \\
|
|
\& \&\& & right \\
|
|
or || & right \\
|
|
, & -- \\
|
|
<- := & right \\
|
|
if & -- \\
|
|
; & right \\
|
|
\hline
|
|
\end{tabular}
|
|
%}
|
|
|
|
{%html:
|
|
<table align=center border=1>
|
|
<thead><tr><th>Operator class</th><th>Associativity </th></tr></thead>
|
|
<tr><td><code class=code>!… ~…</code> </td><td>–</td></tr>
|
|
<tr><td><code class=code>.…() .…[] .…{} </code>
|
|
</td><td>–</td></tr>
|
|
<tr><td><code class=code>#…</code> </td><td> left </td></tr>
|
|
<tr><td><code class=code>function application</code> </td><td> left </td></tr>
|
|
<tr><td><code class=code>- -.</code> </td><td>–</td></tr>
|
|
<tr><td><code class=code>**… lsl lsr asr </code></td><td> right </td></tr>
|
|
<tr><td><code class=code>*… /… %… mod land lor lxor</code>
|
|
</td><td> left </td></tr>
|
|
<tr><td><code class=code>+… -…</code> </td><td> left </td></tr>
|
|
<tr><td><code class=code>::</code> </td><td> right </td></tr>
|
|
<tr><td><code class=code>@… ^… </td><td> right </td></tr>
|
|
<tr><td><code class=code>=… <…
|
|
>… |… &… $… !=</code> </td><td> left </td></tr>
|
|
<tr><td><code class=code>& &&</code> </td><td> right </td></tr>
|
|
<tr><td><code class=code>or || </code> </td><td> right </td></tr>
|
|
<tr><td><code class=code>,</code> </td><td>–</td></tr>
|
|
<tr><td><code class=code><- :=</code> </td><td> right </td></tr>
|
|
<tr><td><code class=code>if</code> </td><td>–</td></tr>
|
|
<tr><td><code class=code>;</code> </td><td> right </td></tr>
|
|
</table>
|
|
%}
|
|
|
|
{%man:
|
|
.IP Associativity
|
|
Operator class
|
|
.IP -
|
|
!.. ~..
|
|
.IP -
|
|
\&.() .[] .{}
|
|
.IP left
|
|
#..
|
|
.IP left
|
|
function application
|
|
.IP -
|
|
- -.
|
|
.IP right
|
|
**.. lsl lsr asr
|
|
.IP left
|
|
*.. /.. %.. mod land lor lxor
|
|
.IP left
|
|
+.. -..
|
|
.IP right
|
|
::
|
|
.IP right
|
|
@.. ^..
|
|
.IP left
|
|
=.. <.. >.. |.. &.. $.. !=
|
|
.IP right
|
|
& &&
|
|
.IP right
|
|
or ||
|
|
.IP -
|
|
,
|
|
.IP right
|
|
<- :=
|
|
.IP -
|
|
if
|
|
.IP right
|
|
;
|
|
%}
|