Content deleted Content added
m Robot-assisted disambiguation (you can help!): C programming language |
m Robot-assisted disambiguation (you can help!): Haskell programming language |
||
Line 7:
Conventionally, the computing usage of "operator" goes beyond the set of common arithmetic operators. The [[C (programming language)|C programming language]], for example, also supports operators like <tt>&</tt>, <tt>++</tt> and <tt>sizeof</tt>. Operators like <tt>sizeof</tt>, which are alphanumeric rather than a mathematical symbol or a punctuation character, are sometimes called ''named operators''. See [[Operators in C and C Plus Plus|Operators in C and C++]]. Operators in C are primitive operations of the language that the compiler can fairly directly map into the machine instructions of microprocessors.
On the other hand, in languages such as [[Haskell (programming language)|Haskell]] and [[Prolog]], operators are a purely syntactic concept. Any combination of symbols and punctuation can be used as an operator, and its [[Order of operations|precedence]] and [[associativity]] can be set. While Haskell only allows new binary operators, Prolog allows one to define operators that are either unary or binary and either prefix, infix or postfix. In Haskell, the operator can be defined and applied just like a function and vice versa by the appropriate use of parentheses or backquotes. Analogously in Prolog, ''[[Prolog#Terms|terms]]'' use either operators or normal ''[[functional predicate|functors]]'' and quotes convert between the usages.
In certain programming languages, such as [[PostScript programming language|PostScript]], the use of the word "operator" has more specific meaning, in that an operator is an executable element in the stack. Because operators here are always written postfix, the need for parentheses is redundant as the way objects are taken from the stack ensures correct evaluation. This is an example of [[Reverse Polish notation]].
|