Sather Home Page

Section 6.8.12:
Infix Expression

Sather identifies a number of infix operand tokens with corresponding method names. An expression written using the operator tokens has identical semantics to its corresponding method call.

The following table gives the full detail of the operator/method correspondence, its name (eg aget) and the normal call expression syntax.

NOTE Apart from things like aget and aset which are unique to Sather in this form, the rest of the contents of the table should be self-explanatory to someone familiar with other programming languages.
Operator Form Name Call Expression
Unary Operators
- expr Negation expr.negate
~ expr Inversion expr.not
[expr-list] Indexing aget(expr-list)
Binary Operators
expr1 + expr2 Addition expr1.plus(expr2)
expr1 - expr2 Subtraction expr1.minus(expr2)
expr1 * expr2 Multiplication expr1.times(expr2)
expr1 / expr2 Division expr1.div(expr2)
expr1 ^ expr2 Exponent expr1.pow(expr2)
expr1 % expr2 Modulus expr1.mod(expr2)
expr1 < expr2 Less than expr1.is_lt(expr2)
expr1 = expr2 Equality expr1.is_eq(expr2)
expr1 /= expr2 Not Equal expr1.is_eq(expr2).not
expr1 > expr2 Greater than expr2.is_lt(expr1)
expr1 >= expr2 Not less than expr1.is_lt(expr2).not
expr1[expr-list] Indexing expr1.aget(expr-list)

Concrete Syntax

infix expression = unary expression | binary expressions ;
unary expression = unary operator, expression ;
binary expression = expression, binary operator, expression ;

Abstract Syntax

Static Semantics

Dynamic Semantics


Specification Index Language Index Section 6 Index
Comments or enquiries should be made to Keith Hopper.
Page last modified: Thursday, 26 April 2001.
Produced with Amaya