Next: , Previous: , Up: iklib syntaxes infix   [Index]


6.8.16.2 Operators precedence

To determine sensible precedences for operators, we make the following observations:

So Vicare defines operators precedence as follows, from high precedence to low precedence:

  1. Procedure application: the left parenthesis preceeded by an identifier starts a procedure application.
  2. Binary infix bitwise shift operators:
    bitwise-arithmetic-shift-left
    bitwise-arithmetic-shift-right
    fxarithmetic-shift-left
    fxarithmetic-shift-right
    
  3. Unary prefix bitwise operators:
    bitwise-not fxnot
    
  4. Binary infix bitwise operators:
    bitwise-and bitwise-ior bitwise-xor
    fxand fxior fxxor
    
  5. Unary prefix arithmetic operators:
    + - ++ -- fx+ fx- fl+ fl-
    
  6. Unary postfix arithmetic operators:
    ++ -- !
    
  7. Binary infix arithmetic exponentiation operators:
    expt flexpt
    
  8. Binary infix arithmetic modulo operators:
    mod mod0 fxmod fxmod0
    
  9. Binary infix multiplication and division arithmetic operators:
    * / div div0 fl* fl/ fx* fxdiv fxdiv0
    
  10. Binary infix addition and subtraction arithmetic operators:
    + - fl+ fl- fx+ fx-
    
  11. Comparison operators:
    < > <= >= = !=
    fx<? fx>? fx<=? fx>=? fx=?
    fl<? fl>? fl<=? fl>=? fl=?
    eq? eqv? equal?
    
  12. Unary prefix logical operators:
    not
    
  13. Binary infix logical operators:
    and or xor
    
  14. Ternary conditional operator … ? … : ….
  15. Procedure application arguments separator, which is the comma.

Here some expansion examples:

(infix ! 2 + 3)         → (not (2 + 3))
(infix (! 2) + 3)       error→ expected numeric argument

(infix fxnot 3)         ⇒ -3
(infix fxnot 3 + 10)    ⇒ 7

(infix ! cos(3))        → (not (cos 3))

Next: , Previous: , Up: iklib syntaxes infix   [Index]