Operator precedence: Difference between revisions

Add Ecstasy table
(Operator precedence en FreeBASIC)
(Add Ecstasy table)
 
(24 intermediate revisions by 16 users not shown)
Line 16:
=={{header|8th}}==
In 8th it's very simple: the currently invoked word has precedence, and items are operated upon in the order they are popped off the stack.
 
=={{header|6502 Assembly}}==
There are two types of indirect addressing: Indirect X and Indirect Y. These differ in that the indirect X mode applies the offset before looking up the address.
 
<syntaxhighlight lang="6502asm">LDX #$02
LDY #$03
 
LDA ($20,x) ;uses the values stored at $20+x and $21+x as a memory address, and reads the byte at that address.
LDA ($20),y ;uses the values store at $20 and $21 as a memory address, and reads the byte at that address + Y.</syntaxhighlight>
 
The use of parentheses for these modes is required, and nicely illustrates the order of operations. To put it in terms of a hierarchy:
<pre>
Highest: Indirection: ()
Middle: Offsetting: ,x ,y
Lowest: Reading at the specified address.
</pre>
 
=={{header|Ada}}==
Line 216 ⟶ 232:
 
This works for mathematical expressions too, since they are treated as normal function calls.
 
<lang rebol>print 2 + 3 * 5 ; 17, same as 2 + (3 * 5)
print 3 * 5 + 2 ; 30, same as 3 * (5 + 2)</lang>
 
See [https://arturo-lang.io/documentation/language/#precedence-and-evaluation Arturo documentation].
 
<syntaxhighlight lang="rebol">print 2 + 3 * 5 ; same as 2 + (3 * 5)
print 3 * 5 + 2 ; same as 3 * (5 + 2)</syntaxhighlight>
 
{{out}}
 
<pre>17
21</pre>
 
=={{header|AWK}}==
See also: [https://www.gnu.org/software/gawk/manual/html_node/Precedence.html#Precedence gawk-Reference]
<syntaxhighlight lang="awk">
<lang AWK>
# Operators are shown in decreasing order of precedence.
# A blank line separates groups of operators with equal precedence.
Line 286 ⟶ 307:
# ^= exponentiation assignment
# **= exponentiation assignment (not all awk's)
</syntaxhighlight>
</lang>
 
=={{header|BASIC256}}==
Operators are evaluated according to a strict set of rules.
These rules are called the “Order of Operations”.
 
{| class="wikitable"
! Priority || Operator(s) || Category/Description
|-
| ALIGN=CENTER|highest || () ||Grouping
|-
| ALIGN=CENTER|10 || ^ ||Exponent
|-
| ALIGN=CENTER| 9 || - ~ ||Unary Minus and Bitwise Negation (NOT)
|-
| ALIGN=CENTER| 8 || * / \ ||Multiplication, Division, and Integer Division
|-
| ALIGN=CENTER| 7 || % ||Integer Remainder (Mod)
|-
| ALIGN=CENTER| 6 || + - ; ||Addition/Concatenation, and Subtraction
|-
| ALIGN=CENTER| 5 || & <nowiki>|</nowiki> ||Bitwise And and Bitwise Or
|-
| ALIGN=CENTER| 4 || < <= > >= = <> ||Comparison (Numeric and String)
|-
| ALIGN=CENTER| 3 || NOT ||Logical Not
|-
| ALIGN=CENTER| 2 || AND ||Logical And
|-
| ALIGN=CENTER| 1 || OR ||Logical Or
|-
| ALIGN=CENTER|lowest || XOR ||Logical Exclusive Or
|}
 
 
=={{header|bc}}==
Line 314 ⟶ 368:
|-
| Lowest || <nowiki>||</nowiki> || Logical Or || Left to right
|}
 
=={{header|BCPL}}==
In the table below, L indicates left associativity and R indicates right associativity.
{| class="wikitable"
! Priority !! Operator !! Notes
|-
|| 9 || Names, Literals, <code>?</code>
|-
|| || <code>TRUE</code>, <code>FALSE</code>, <code>BITSPERBCPLWORD</code>
|-
|| || (E)
|-
|| 9L || <code>SLCT</code>, <code>:</code> || Field selectors
|-
|| || Function and method calls
|-
|| || Subscripted expressions using <code>[</code> and <code>]</code>
|-
|| 8L || <code>!</code>, <code>%</code>, <code>OF</code> || Dyadic
|-
|| 7 || <code>!</code>, <code>@</code> || Prefixed
|-
|| 6L || <code>*</code>, <code>/</code>, <code>MOD</code>
|-
|| 5 || <code>+</code>, <code>-</code>, <code>ABS</code> || Dyadic and monadic
|-
|| 4 || <code>=</code>, <code>~=</code>, <code><=</code>, <code>>=</code>, <code><</code>, <code>></code> || Extended relations
|-
|| 4L || <code><<</code>, <code>>></code> || Bit shift operators
|-
|| 3 || <code>~</code>
|-
|| 3L || <code>&</code>
|-
|| 2L || <code><nowiki>|</nowiki></code>
|-
|| 1L || <code>EQV</code>, <code>XOR</code>
|-
|| 1R || <code>-> ,</code> || Conditional expression
|-
|| 0 || <code>VALOF</code>, <code>TABLE</code>
|}
=={{header|BQN}}==
 
The operators of most popular programming languages correspond to functions in BQN (all functions, builtin and defined, are infix).
 
However, modifiers (higher order functions) have higher precedence over functions.
 
Here, <code>2 + 1</code> is evaluated first:
<syntaxhighlight lang="bqn">3 * 2 + 1</syntaxhighlight>
 
Here, <code>-˜</code> is evaluated first. <code>˜</code> flips the arguments given to a function.
<syntaxhighlight lang="bqn">3 * 2 -˜ 1</syntaxhighlight>
 
A precedence table for all BQN syntax is shown below.
 
{| class="wikitable"
! Precedence !! Role !! Associativity !! Examples and comments
|-
| Highest || Brackets || || <code>()⟨⟩{}[]</code>
|-
| || <code>.</code> || Left || Namespace field access
|-
| || <code>‿</code> || || Stranding (forms lists); really an n-ary instead of binary operator
|-
| || Modifier || Left || e.g. <code>∘⎉¨´</code>, also modified assignment <code>↩</code> in <code>Fn↩</code>
|-
| || Function || Right || e.g. <code>+↕⊔⍉</code> (including in trains), also assignment <code>←↩⇐</code>
|-
| Lowest || Separator || || <code>⋄,</code> and newline, and block punctuation <code>;:?</code>
|}
 
Line 607 ⟶ 732:
 
For quick reference, see also [http://cpp.operator-precedence.com this] equivalent, color-coded table.
 
=={{header|C sharp|C#}}==
[http://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/ MSDN documentation]
 
=={{header|Caché ObjectScript}}==
Line 724 ⟶ 852:
| 0 || Range separator || .. || Not a real operator, hardwired into syntax at specific points
|}
 
=={{header|dc}}==
As ''dc'' is a reverse-polish calculator, all operators/commands pop their arguments off the stack. They are simply evaluated in the order they appear in the code (from left to right).
 
=={{header|Delphi}}==
See table at [[#Free Pascal|Free Pascal]].
 
=={{header|Ecstasy}}==
 
Ecstasy's precedence table is based loosely on the C family of languages, but with significant tweaks to support the most common patterns without parenthesis. At a given level of precedence, all evaluation is from left to right.
 
{| class="wikitable"
! Order !! Operator !! Description !! Associativity
|-
| 1 || & || Unary reference-of, based on C syntax || Right-to-left
|-
| 2 || ++ || Post-increment || Left-to-right
|-
| || -- || Post-decrement ||
|-
| || () || Invoke method / call function ||
|-
| || [] || Array access ||
|-
| || ? || Postfix conditional ||
|-
| || . || Access object member ||
|-
| || .new || Postfix object creation ||
|-
| || .as || Postfix type assertion ||
|-
| || .is || Postfix type comparison ||
|-
| 3 || ++ || Pre-increment || Right-to-left
|-
| || -- || Pre-decrement ||
|-
| || + || Unary plus ||
|-
| || - || Unary minus ||
|-
| || ! || Logical NOT ||
|-
| || ~ || Bitwise NOT ||
|-
| 4 || ?: || Conditional "Elvis" || Right-to-left
|-
| 5 || * || Multiply || Left-to-right
|-
| || / || Divide ||
|-
| || % || Modulo ||
|-
| || / || Divide with remainder ||
|-
| 6 || + || Add || Left-to-right
|-
| || - || Subtract ||
|-
| 7 || << || Shift left || Left-to-right
|-
| || >> || Arithmetic shift right ||
|-
| || >>> || Logical shift right ||
|-
| || & || And ||
|-
| || ^ || Xor ||
|-
| || <nowiki>|</nowiki> || Or ||
|-
| 8 || .. || Range/intervale || Left-to-right
|-
| 9 || <- || Assignment || Right-to-left
|-
| 10 || < <= > >= || Relational || Left-to-right
|-
| || <=> || Order ||
|-
| 11 || == || Equality || Left-to-right
|-
| || != || Inequality ||
|-
| 12 || && || Conditional AND || Left-to-right
|-
| 13 || ^^ || Conditional XOR || Left-to-right
|-
| || <nowiki>||</nowiki> || Conditional OR ||
|-
| 14 || ? : || Conditional ternary || Right-to-left
|-
| 15 || : || Conditional ELSE || Right-to-left
|}
 
=={{header|Eiffel}}==
 
Line 863 ⟶ 1,084:
 
=={{header|Erlang}}==
Official documentation table: [[http://erlang.org/doc/reference_manual/expressions.html]], see "Operator Precedence" towards the end.
{| class="wikitable"
!Operators !! Associativity
|-
||<code>:</code> ||
|-
||<code>#</code> ||
|-
||(unary) <code>+</code>, (unary) <code>-</code>, <code>bnot</code>, <code>not</code> ||
|-
||<code>/</code>, <code>*</code>, <code>div</code>, <code>rem</code>, <code>band</code>, <code>and</code> || Left
|-
||<code>+</code>, <code>-</code>, <code>bor</code>, <code>bxor</code>, <code>bsl</code>, <code>bsr</code>, <code>or</code>, <code>xor</code> || Left
|-
||<code>++</code>, <code>--</code>||Right
|-
||<code>==</code>, <code>/=</code>, <code>=<</code>, <code><</code>, <code>>=</code>, <code>></code>, <code>=:=</code>, <code>=/=</code>||
|-
||<code>andalso</code>||
|-
||<code>orelse</code>||
|-
||<code>=</code>, <code>!</code>||Right
|-
||<code>catch</code>
|}
 
=={{header|F_Sharp|F#}}==
Line 1,042 ⟶ 1,288:
|}
 
=={{header|Free Pascal}}==
{| class="wikitable" style="margin: auto;"
|+ operator precedence in FreePascal
! operator !! precedence !! category
|-
| <code>not</code>, unary&nbsp;<code>+</code>, unary&nbsp;<code>-</code>, <code>@</code>, <code>**</code> || highest (first) || unary operators, power
|-
| <code>*</code>, <code>/</code>, <code>div</code>, <code>mod</code>, <code>and</code>, <code>shl</code>, <code>shr</code>, <code>as</code>, <code><<</code>, <code>>></code>, <strike><code>is</code> [until FPC 3.3.1]</strike>
| second
| multiplying operators
|-
| <code>+</code>, <code>-</code>, <code>or</code>, <code>xor</code>, <code>><</code>
| third
| adding operators
|-
| <code>=</code>, <code><></code>, <code><</code>, <code>></code>, <code><=</code>, <code>>=</code>, <code>in</code>, <code>is</code> [since FPC 3.3.1]
| lowest
| relational operators
|}
 
“[B]inary operators of the same precedence are left-associative.”
Nevertheless, “[t]he order in which expressions of the same precedence are evaluated is not guaranteed to be left-to-right.”
(quotes from the Free Pascal Reference Guide)
 
The default configuration sets <code>{$boolEval off}</code> (<code>{$B-}</code> for short).
This enables “lazy evaluation” and thus affects evaluation order.
 
One notable difference to standardized [[#Pascal|Pascal]] in operator precedence can be switched:
Normally, Free Pascal’s unary minus is at the highest precedence level.
With <code>{$modeSwitch ISOUnaryMinus+}</code>, which is enabled by default in <code>{$mode ISO}</code> and <code>{$mode extendedPascal}</code>, unary minus can be put at the same level as all other adding operators (like the ISO standards define).
 
=={{header|Furor}}==
Line 1,121 ⟶ 1,397:
! style="text-align: left" | Associativity
|-
! 910
<small>highest</small>
| <code>f x</code>
| Function application
| Left
|-
! 9
| <code>.</code>
| Function composition
Line 1,128 ⟶ 1,409:
|-
! 8
| <code>^, ^^, **</code>
| Power
| Right
|-
! 7
| <code>*, /, `quot`, `rem`, `div`, `mod`</code>
|
| Left
|-
! 6
| <code>+, -</code>
|
| Left
|-
! 5
| <code>: ++</code>
| Append to list
| Right
|-
! 4
| <code>==, /=, &lt;, &lt;=, &gt;=, &gt; </code>
| Comparisons
| Compare-operators
|
|-
! 4
| <code>&lt;*&gt; &lt;$&gt; </code>
| Functor ops
| Left
|-
! 3
Line 1,163 ⟶ 1,449:
|-
! 1
| <code>&gt;&gt;, &gt;&gt;=</code>
| Monadic ops
|
| Left
|-
! 1
| <code>=&lt;&lt; &lt;&vert;&gt; </code>
|
| Right
|-
! 0
| <code>$, $!, `seq`</code>
|
| Right
Line 1,305 ⟶ 1,591:
Here's an informal treatment of the grammar:
 
Conjunctions require a left and right argument, either of which may be a noun or a verb. If one argument is omitted the conjunction is curried with the remaining argument, forming an adverb (if the right argument is omitted, the precedence of the conjunction is treated as lower than the precedence of a verb -- this might be thought of as a consequence of the "long left scope" of conjunctions extending as far as possible).
 
Adverbs require a single left argument, which may be a noun or a verb.
Line 1,431 ⟶ 1,717:
 
=={{header|Lambdatalk}}==
<syntaxhighlight lang="scheme">
<lang Scheme>
As with Common Lisp and Scheme, Lambdatalk uses s-expressions so there is no need for operator precedence.
Such an expression "1+2*3+4" is written {+ 1 {* 2 3} 4}
</syntaxhighlight>
</lang>
 
=={{header|Lang}}==
<pre>
# Precedence | Operator | Associativity | Operator name
# ===========|====================|===============|==========================================
# 0 | (opr) | - | Grouping
# | opr1(opr2) | left-to-right | Function calls
# | opr1[opr2] | left-to-right | Get item
# | opr1?.[opr2] | left-to-right | Optional get item
# | opr1::opr2 | left-to-right | Member access [1]
# | opr1?::opr2 | left-to-right | Optional member access [1]
# | opr1->opr2 | left-to-right | Member access pointer [1]
# -----------|--------------------|---------------|------------------------------------------
# 1 | @opr | right-to-left | Length
# | ^opr | | Deep copy
# -----------|--------------------|---------------|------------------------------------------
# 2 | opr1 ** opr2 | right-to-left | Power [2]
# -----------|--------------------|---------------|------------------------------------------
# 3 | +opr | right-to-left | Positive
# | -opr | | Inverse
# | ~opr | | Bitwise not
# | +|opr | | Increment
# | ▲opr | | Increment [Alternative non-ascii symbol]
# | -|opr | | Decrement
# | ▼opr | | Decrement [Alternative non-ascii symbol]
# | !opr | | Not
# -----------|--------------------|---------------|------------------------------------------
# 4 | opr1 * opr2 | left-to-right | Multiplication
# | opr1 / opr2 | | Division
# | opr1 ~/ opr2 | | Truncation division
# | opr1 // opr2 | | Floor division
# | opr1 ^/ opr2 | | Ceil division
# | opr1 % opr2 | | Modulo
# -----------|--------------------|---------------|------------------------------------------
# 5 | opr1 ||| opr2 | left-to-right | Concat
# | opr1 + opr2 | | Addition
# | opr1 - opr2 | | Subtraction
# -----------|--------------------|---------------|------------------------------------------
# 6 | opr1 << opr2 | left-to-right | Left shift
# | opr1 >> opr2 | | Right shift
# | opr1 >>> opr2 | | Right zero shift
# -----------|--------------------|---------------|------------------------------------------
# 7 | opr1 & opr2 | left-to-right | Bitwise and
# -----------|--------------------|---------------|------------------------------------------
# 8 | opr1 ^ opr2 | left-to-right | Bitwsie xor
# -----------|--------------------|---------------|------------------------------------------
# 9 | opr1 | opr2 | left-to-right | Bitwise or
# -----------|--------------------|---------------|------------------------------------------
# 10 | opr1 <=> opr2 | left-to-right | Spaceship
# | opr1 ~~ opr2 | | Instance of
# | opr1 == opr2 | | Equals
# | opr1 != opr2 | | Not equals
# | opr1 =~ opr2 | | Matches
# | opr1 !=~ opr2 | | Not matches
# | opr1 === opr2 | | Strict equals
# | opr1 !== opr2 | | Strict not equals
# | opr1 < opr2 | | Less than
# | opr1 > opr2 | | Greater than
# | opr1 <= opr2 | | Less than or equals
# | opr1 >= opr2 | | Greater than or equals
# -----------|--------------------|---------------|------------------------------------------
# 11 | opr1 && opr2 | left-to-right | And
# -----------|--------------------|---------------|------------------------------------------
# 12 | opr1 || opr2 | left-to-right | Or
# -----------|--------------------|---------------|------------------------------------------
# 13 | opr1 ?: opr2 | left-to-right | Elvis
# | opr1 ?? opr2 | | Null coalescing
# -----------|--------------------|---------------|------------------------------------------
# 14 | opr1 ? opr2 : opr3 | right-to-left | Inline if
# -----------|--------------------|---------------|------------------------------------------
# 15 | opr1 , opr2 | left-to-right | Comma
# -----------|--------------------|---------------|------------------------------------------
# 16 | opr1 = opr2 | right-to-left | Normal assignment
# | opr1 = opr2 | | Translation
# | opr1 ::= opr2 | | Lvalue operation assignment
# | opr1 ?= opr2 | | Condition operator assignment
# | opr1 := opr2 | | Math operator assignment
# | opr1 $= opr2 | | Operation operator assignment
# | opr1 += opr2 | | Addition assignment
# | opr1 -= opr2 | | Subtraction assignment
# | opr1 *= opr2 | | Multiplication assignment
# | opr1 /= opr2 | | Division assignment
# | opr1 ~/= opr2 | | Truncation division assignment
# | opr1 //= opr2 | | Floor division assignment
# | opr1 ^/= opr2 | | Ceil division assignment
# | opr1 **= opr2 | | Power assignment
# | opr1 %= opr2 | | Modulo assignment
# | opr1 >>= opr2 | | Right shift assignment
# | opr1 >>>= opr2 | | Right zero shift assignment
# | opr1 <<= opr2 | | Left shift assignment
# | opr1 &= opr2 | | Bitwise and assignment
# | opr1 ^= opr2 | | Bitwise xor assignment
# | opr1 |= opr2 | | Bitwise or assignment
# | opr1 |||= opr2 | | Concat assignment
# | opr1 ?:= opr2 | | Elvis assignment
# | opr1 ??= opr2 | | Null coalescing assignment
#
# Footnotes:
# 1) The unary operators (@, ^, +, -, ~, +|, ▲, -|, ▼, and !) have a higher binding than the member access operators if they are on the right of the member access operator.
# 2) The unary operators (+, -, ~, +|, ▲, -|, ▼, and !) have a higher binding than the power operator if they are on the right of the power operator.
#
# Some operators have multiple meanings but they keep the same precedence and associativity
</pre>
 
=={{header|LIL}}==
Line 1,524 ⟶ 1,913:
# Binding is done at the call site; therefore, method lookup is syntactically part of the call
 
=={{header|Mathematica}}/{{header|Wolfram Language}}==
Here is an outline:
{| class="wikitable"
Line 1,629 ⟶ 2,018:
=={{header|min}}==
min is a stack language that uses postfix notation, so for the most part, all operators have the same precedence. Sigils are a small exception. However, they de-sugar to postfix. For example, the following two lines are equivalent:
<langsyntaxhighlight lang="min">42 :my-var
42 "my-var" define</langsyntaxhighlight>
 
=={{header|Nim}}==
Line 1,686 ⟶ 2,075:
 
=={{header|OCaml}}==
[httphttps://camlocaml.inria.fr/pub/docsorg/manual-ocaml/expr.html#@manual.kwd32ss:precedence-and-associativity This table] contains the precedence and associativity of operators and other expression constructs in OCaml, including user-defined operators.
 
=={{header|Odin}}==
Unary operators have the highest precedence.
 
There are seven precedence levels for binary and ternary operators.
 
{| class="wikitable"
!Precedence !! Operator
|-
|| 7 || <code>*</code> <code>/</code> <code>%</code> <code>%%</code> <code>&</code> <code>&~</code> <code><<</code> <code>>></code>
|-
|| 6 || <code>+</code> <code>-</code> <code><nowiki>|</nowiki></code> <code>~</code> <code>in</code> <code>not_in</code>
|-
|| 5 || <code>==</code> <code>!=</code> <code><</code> <code>></code> <code><=</code> </code>>=</code>
|-
|| 4 || <code>&&</code>
|-
|| 3 || <code><nowiki>||</nowiki></code>
|-
|| 2 || <code>..=</code> <code>..<</code>
|-
|| 1 || <code>or_else</code> <code>?</code> <code>if</code> <code>when</code>
|}
Binary operators of the same precedence associate from left to right. For instance "x / y * z" is the same as "(x / y) * z"
=={{header|Oforth}}==
 
Line 1,764 ⟶ 2,176:
 
=={{header|Pascal}}==
Standard Pascal, as laid out in ISO standard 7185, recognizes four precedence levels.
This table contains the precedence and associativity of operators:
Extended Pascal (EP), defined in ISO standard 10206, has one additional level, [[Exponentiation with infix operators in (or operating on) the base#Pascal|exponentiating operators]].
{| class="wikitable"
The following is a consolidated table for both standards:
! Priority || Description || Operators || Associativity
 
|-
{| class="wikitable" style="margin: auto;"
| highest || || ||
|+ operator precedence in Pascal
! class !! operators
|-
| 1negation || unary operators ||<code> not @ </code>|| left to right
* <code>not</code>
|-
| exponentiating operators ||
| 2 || mult operators ||<code> * / div mod and shl shr as << >> </code>|| left to right
* <code>**</code> (only in EP)
* <code>pow</code> (only in EP)
|-
| 3 || add multiplying operators ||<code> + - or xor </code>|| left to right
* <code>*</code>
* <code>/</code>
* <code>div</code>
* <code>mod</code>
* <code>and</code>
* <code>and_then</code> (only available in EP)
|-
| adding operators ||
| 4 || relations ||<code> = <> < > <= >= in is </code>|| left to right
* <code>+</code>
* <code>-</code>
* <code>><</code> (only in EP)
* <code>or</code>
* <code>or_else</code> (only available in EP)
|-
| relational operators ||
| lowest || || ||
* <code>=</code>
* <code><></code>
* <code><</code>
* <code>></code>
* <code><=</code>
* <code>>=</code>
* <code>in</code>
|}
“Sequences of two or more operators of the same precedence shall be left associative.”
'''Example'''::<br>
(quote from ISO standards)
The expression <code> ( a>n and b<n ) </code> is equivalent to :
 
<code> ( ( a > (n and b) ) < n ) </code> , so, it is invalid !<br>
However, unlike some other programming languages, operator precedence ''does not'' define evaluation order.
we must code:<br>
This is because Pascal does not permit “lazy evaluation”:
<code> (a>n) and (b<n)</code>
Except in the case of <code>and_then</code> and <code>or_else</code>, the ''evaluation order implementation-defined''.
Some compilers, for instance the FPC ([[#Free Pascal|Free Pascal]] Compiler), evaluate “more complex” subexpression first before evaluating “easy” subexpressions (rationale: avoid register spilling).
 
=={{header|Perl}}==
Line 1,791 ⟶ 2,228:
=={{header|Phix}}==
{{libheader|Phix/basics}}
<!--(phixonline) - p2js automatically inserts paranthesis where/when needed-->
{| class="wikitable"
! style="text-align: left" | Precedence
Line 1,834 ⟶ 2,272:
 
Perhaps surprisingly Phix does not rely on associativity, mainly because it has a power() function rather than an infix operator for that.<br> You could alternatively say that all the above operators bar the unary ops are left associative, within their own precedence level.
 
Phix has reference counting with copy-on-write semantics: technically parameters are always passed by reference, which can improve performance, however attempting to modify anything with a reference count greater than one performs an internal clone (at that level) which means it ''behaves'' as if everything were being passed by value.<br>
It also has automatic pass by reference for local variables such that (eg) <code>table = somefunc(table)</code> does ''not'' increase the reference count (in practice the calling code's local variable becomes unassigned over the call) and consequently makes in-situ modification possible, which can obviously also significantly benefit performance.<br>
Under "with js", aka "with javascript_semantics", any said internal clone triggers a runtime error, effectively prohibiting copy-on-write semantics and thus ensuring the code is compatible with JavaScript, and in fact also implicitly banning the usual pass-by-sharing semantics of JavaScript, except where covered by the automatic pbr handling.
 
=={{header|PHP}}==
Line 1,870 ⟶ 2,312:
| lowest || || ||
|}
 
=={{header|Plain English}}==
Plain English treats an expression if it contains any of the operators 'plus', 'minus', 'times', 'divided by', or 'then'. Arguments in expressions are passed in by reference. Expressions are evaluated from left to right, ignoring traditional precedence rules.
 
For example, when evaluating 2 + 3 * 4, Plain English will calculate (2 + 3) * 4, and not 2 + (3 * 4).
 
=={{header|PureBasic}}==
Line 1,979 ⟶ 2,426:
=={{header|Q}}==
Operators have equal precedence and expressions are evaluated from right to left.
<langsyntaxhighlight lang="q">q)3*2+1
9
q)(3*2)+1 / Brackets give the usual order of precedence
Line 1,985 ⟶ 2,432:
q)x:5
q)(x+5; x:20; x-5)
25 20 0</langsyntaxhighlight>
 
=={{header|Quackery}}==
Line 1,993 ⟶ 2,440:
=={{header|Racket}}==
Racket uses S-expr for its syntax, operators and functions show no precedences as all code is written as:
<syntaxhighlight lang Racket="racket">(function arguments ...)</langsyntaxhighlight>
 
function being any function or operator (language or user defined) and arguments are the arguments passed to it.
Line 2,129 ⟶ 2,576:
 
=={{header|Ring}}==
<langsyntaxhighlight lang="ring">
The next table present operators from higher precedence (Evaluated first) to lower precedence.
 
Line 2,151 ⟶ 2,598:
 
See 3+5*4 # prints 23
</syntaxhighlight>
</lang>
 
=={{header|Ruby}}==
Line 2,243 ⟶ 2,690:
the Seed7 Structured Syntax Description ([http://seed7.sourceforge.net/manual/syntax.htm S7SSD])
A S7SSD statement like
<langsyntaxhighlight lang="seed7">$ syntax expr: .(). + .() is -> 7;</langsyntaxhighlight>
specifies the syntax of the <code>+</code> operator.
The right arrow <code>-&gt;</code> describes the associativity:
Binding of operands from left to right. With <code>7</code> the priority
of the <code>+</code> operator is defined. The syntax pattern
<syntaxhighlight lang ="seed7">.(). + .()</langsyntaxhighlight>
is introduced and delimited with dots (<code>.</code>). Without dots the pattern is
<pre>() + ()</pre>
Line 2,308 ⟶ 2,755:
 
For example:
<langsyntaxhighlight lang="ruby">1+2 * 3+4 # means: (1+2) * (3+4)</langsyntaxhighlight>
 
See also the [https://trizen.gitbooks.io/sidef-lang/content/syntax_and_semantics/operator_precedence.html documentation] on the precedence of operators.
Line 2,363 ⟶ 2,810:
Math expressions are usually parenthesized for better readability (by beginners):
<langsyntaxhighlight lang="smalltalk">5 + b negated. "same as 5 + (b negated); unary > binary"
a abs - b sqrt "same as (a abs) - (b sqrt); unary > binary"
a bitAnd:1+a abs. "same as a bitAnd:(1+(a abs)); unary > binary > keyword"
Line 2,369 ⟶ 2,816:
 
"Beginners might be confused by:"
5 + a * b "same as (5 + a) * b; all binary; therefore left to right"</langsyntaxhighlight>
 
=={{header|Standard ML}}==
162

edits