Operator Features in Programming Languages
The following table shows the operator features in several programming languages:
Programming language | Nonalphanumeric operator symbols | Alphanumeric operator symbols | Prefix | Infix | Postfix | Precedence | Associativity | Overloading | Programmer-defined overloading | Programmer-defined operator symbols |
---|---|---|---|---|---|---|---|---|---|---|
ALGOL 68 | +* ** * / % %* %× - + < <= >= > = /= & -:= +:= *:= /:= %:= %*:= +=: :=: :/=:
(All operators have bold Alphanumeric equivalents, c.f. next column. Some have non ASCII equivalents, c.f. below.) ¬ +× ⊥ ↑ ↓ ⌊ ⌈ × ÷ ÷× ÷* □ ≤ ≥ ≠ ∧ ∨ ×:= ÷:= ÷×:= ÷*:= %×:= :≠: |
not abs arg bin entier leng level odd repr round shorten i shl shr up down lwb upb lt le ge gt eq ne and or over mod elem minusab plusab timesab divab overab modab plusto is isnt | Yes | Yes | No | Yes | Infix operators are left associative, prefix operators are right associative | Yes | Yes | Yes |
C | -> . ! ~ ++ -- + - * & / % << >> < <= > <= == != ^ | && || ?: = += -= *= /= %= &= ^= |= <<= >>= | sizeof | Yes | Yes | Yes | Yes | Yes | Yes | No | No |
C++ (more) | sizeof new delete throw decltype | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | |
Java | new instanceof | Yes | Yes | Yes | Yes | Yes | Yes | No | No | |
Haskell | + - * / ^ ^^ ** == /= > < >= <= && || >>= >> $ $! . ++ !! : | Yes, by putting a function's name into backticks | Yes | Yes | No | Yes | Yes | Yes, using Type classes | Yes | |
Pascal | * / + - = < > <> <= >= := | not div mod and or in | Yes | Yes | No | Yes | Yes | Yes | No | No |
Seed7 | {} -> ** ! + - * / << >> & >< | = <> > >= < <= <& := +:= -:= *:= /:= <<:= >>:= &:= @:= | conv varConv parse conj div rem mdiv mod times mult in not and or digits lpad rpad lpad0 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
Eiffel | + - * / // = /= | not and or implies "and then" "or else" | Yes | Yes | No | Yes | Yes | No | Yes | Yes |
Prolog | spy nospy not is mod | Yes | Yes | Yes | Yes | Yes | No | No | Yes | |
Lisp | Lisp defines all functions and symbols as operators. Following the definition in this page, Lisp has no operators. | Yes | No | No | No | No | No | No | Yes | |
Smalltalk | (yes - Up to two characters) | (yes - Needs a colon after the keyword) | No | Yes | Yes | No | No | Yes | Yes | Yes |
Perl | -> ++ -- ** ! ~ \ + - . =~ !~ * / % < > <= >= == != <=> ~~ & | ^ && || ' | print sort chmod chdir rand and or not xor lt gt le ge eq ne cmp x | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No |
Read more about this topic: Operator (computer Programming)
Famous quotes containing the words features, programming and/or languages:
“It looks as if
Some pallid thing had squashed its features flat
And its eyes shut with overeagerness
To see what people found so interesting
In one another, and had gone to sleep
Of its own stupid lack of understanding,
Or broken its white neck of mushroom stuff
Short off, and died against the windowpane.”
—Robert Frost (18741963)
“If there is a price to pay for the privilege of spending the early years of child rearing in the drivers seat, it is our reluctance, our inability, to tolerate being demoted to the backseat. Spurred by our success in programming our children during the preschool years, we may find it difficult to forgo in later states the level of control that once afforded us so much satisfaction.”
—Melinda M. Marshall (20th century)
“Science and technology multiply around us. To an increasing extent they dictate the languages in which we speak and think. Either we use those languages, or we remain mute.”
—J.G. (James Graham)