next up previous contents
Next: Types Up: Syntax Previous: Identifiers   Contents

Expressions

The grammar rules for an expression are, in order of precedence, from high to low (note $\epsilon$ stands for the empty string):


		 expr::				        id

$\vert$ number
$\vert$ { atom,$\ldots$,atom }
$\vert$ expr :: expr
$\vert$ [-$\vert$+$\vert$*$\vert$&$\vert$|$\vert$^] expr
$\vert$ expr ** expr
$\vert$ expr [*$\vert$/$\vert$«$\vert$»] expr
$\vert$ expr [+$\vert$-] expr
$\vert$ expr mod expr
$\vert$ expr in expr
$\vert$ expr union expr
$\vert$ expr [=$\vert$ =$\vert$<$\vert$<=$\vert$>$\vert$>=] expr
$\vert$ ~ expr
$\vert$ expr & expr
$\vert$ expr [|$\vert$^] expr
$\vert$ expr <-> expr
$\vert$ expr -> expr
$\vert$ expr ? expr : expr
$\vert$ expr .. expr
$\vert$ ( expr )
$\vert$ [ expr,$\ldots$,expr ]
$\vert$ [ expr,$\ldots$,expr : atom = expr .. expr ]
$\vert$ bin ( expr , expr )

All operators of the same precedence except ``?:'' associate to the left. For example, a / b * c is parsed as (a / b) * c. The ternary ``?:'' associates to the right. Thus

        a ? b : c ? d : e
is parsed as
        a ? b : (c ? d : e)



2002-10-28