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:
“These, then, will be some of the features of democracy ... it will be, in all likelihood, an agreeable, lawless, particolored commonwealth, dealing with all alike on a footing of equality, whether they be really equal or not.”
—Plato (c. 427347 B.C.)
“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)
“I am always sorry when any language is lost, because languages are the pedigree of nations.”
—Samuel Johnson (17091784)