Search Top Index
HELP PRECEDENCE A.Sloman, Nov 1987 -- PRECEDENCES OF POP-11 INFIX OPERATIONS ---------------------------- Precedences determine the parsing of complex expressions, especially unbracketed expressions with more than one infix operator. E.g. 3 + 4 * 5 parses as 3 + (4 * 5) rather than (3 + 4) * 5 because the precedence of "+" is higher, i.e. it has higher scope, than that of "*". Precedences can be positive or negative integers or decimals, in the range -12.7 to +12.7 inclusive. So the largest possible precedence is 12.7. Most operations associate to the left; negative precedences can be used for operations which must associate to the right. Absolute value of the precedence determines scope. Positive precedences will be slightly higher than negative ones of the same absolute value. Examples of built in infix operators: NAME PRECEDENCE ARGUMENTS FUNCTION ==== ========== ========= ======== Logical bit manipulation: && 4 2 Logical and &&~~ 4 2 Logical and-not || 4 2 Logical or ~~ 4 1 Logical not ||/& 4 2 Logical exclusive or << 4 2 Logical shift left >> 4 2 Logical shift right Standard arithmetic operations: > 6 2 Greater than >= 6 2 Greater than or equal to < 6 2 Less than <= 6 2 Less than or equal to * 4 2 Multiply ** 3 2 Raise to power + 5 2 Add - 5 2 Subtract / 4 2 Divide // 4 2 Integer divide rem 2 2 Integer remainder mod 2 2 Modulo div 2 2 integer divisor Fast integer (fi_) operations (no run-time type checking) See REF * FASTPROCS Boolean operations: and 9 or 10 Equality tests: = 7 2 Equal == 7 2 Identical ==# 7 2 Numerical equality /= 7 2 Not equal /== 7 2 Not identical NOTE: "=" and "/=" compare components of structures, whereas "==" and "/==" don't, and are therefore faster matches 9 2 Structure matcher --> 9 2 Calls the matcher SEE HELP *MATCHES Structure operations :: 4 2 CONS list link <> 5 2 Concatenate structure >< 5 2 String concatenate ncjoin 5 2 Non-copy list join . 1 1 Apply procedure Others: -> 11 Assignment arrow ->> 11 Assign and stack => 12 Print arrow ( -1 : -1 See HELP *DEFINE - for syntax of procedure definitions (HELP *OPERATION - for syntax of infix operator definitions) REF *POPSYNTAX - for more detailed information on POP-11 syntax --- C.all/help/precedence ---------------------------------------------- --- Copyright University of Sussex 1987. All rights reserved. ----------