[Next] [Up] [Previous] [Contents]
Next: Types Up: Syntax Previous: Identifiers

Expressions

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

 
		 expr::					id

| number

| { atom, tex2html_wrap_inline1008 ,atom }

| expr :: expr

| [-|+|*|&|||^] expr

| expr ** expr

| expr [*|/|<<|>>] expr

| expr [+|-] expr

| expr mod expr

| expr in expr

| expr union expr

| expr [=| =|<|<=|>|>=] expr

| ~ expr

| expr & expr

| expr [||^] expr

| expr <-> expr

| expr -> expr

| expr ? expr : expr

| expr .. expr

| ( expr )

| [ expr, tex2html_wrap_inline1008 ,expr ]

| [ expr, tex2html_wrap_inline1008 ,expr : atom = expr .. expr ]

| 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)



Ken McMillan
Sat Jun 6 21:41:59 PDT 1998