Coronavirus (Covid-19): Latest updates and information
Skip to main content Skip to navigation

Expressions

The precedence of expression operators is as follows, highest precedence first.

All integer overflows are ignored in the current implementation. Division by 0 causes a run-time error.

Lvalue

lvalue:
        identifier
        $
        $number
        lvalue [ expression ]
        * expression
        ` expression `
        ( lvalue )

The dollar sign $ is the actual argument list of a function; $number is the number-th argument where number is a decimal integer constant.

An lvalue followed by an expression in square brackets is an lvalue. The intuitive meaning is that of a subscript. The lvalue must have type string or list. The expression must be of integer type.

The unary * operator means indirection: the expression must be a pointer, the result is an lvalue.

An expression enclosed in a pair of ` (open quotes) is a lvalue where the expression must be of string type. The object, referred to by it, is the object having the name identical to the string. For instance, `"A"` is equivalent to the object A.

A parenthesized lvalue is a lvalue which is identical to the unadorned lvalue.

Primary Expression

primary-expression:
        lvalue
        ( expression )
        primary-expression [ expression ]
        primary-expression ( expression-listopt )

An lvalue is an simple expression. The value of the object is returned.

A parenthesized expression is a primary expression whose type and value are identical to those of the unadorned expression.

A primary expression followed by an expression in square brackets is a primary expression. The intuitive meaning is that of subscript. The primary expression must have type string or list.

A function call is a primary expression followed by parentheses containing a possibly empty, comma-separated list of expressions which constitute the actual arguments to the function. The primary expression must be of type function.

In preparing for the call to a function, a copy is made of each actual parameter (even it is a string or a list); thus all argument-passing in Eden is strictly by value. A function may change the values of its formal parameters, but these changes cannot affect the values of the actual parameters. On the other hand, it is possible to pass a pointer on the understanding that the function may change the value of the object to which the pointer points. The order of evaluation of arguments is undefined by the language. (Although the current implementation evaluates parameters from left to right, the user should not assume this fact.)