Skip to main content

Expressions

Synopsis

The expressions available in Rascal.

Description

The expression is the basic unit of evaluation and may consist of the ingredients shown in the figure.

A function call. First the arguments are evaluated and the corresponding function is called. The value returned by the function is used as value of the function call. See Call. A constructor. First the arguments are evaluated and then a data value is constructed for the corresponding type. This data value is used as value of the constructor. Constructors are functions that can be used in all contexts where functions can be used. See Constructor.

  • An operator expression. The operator is applied to the arguments; the evaluation order of the arguments depends on the operator. The result returned by the operator is used as value of the operator expression. See Operators.

  • ./Comprehensions.

  • A Visit expression.

  • A Any expression.

  • An All expression.

  • Some statements like If, For, While and Do can also be used in expressions, see Statement as Expression.