Skip to main content




The expressions available in Rascal.


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

  • An elementary literal value, e.g. constants of the types Boolean, Integer, Real, Number, String, Location or DateTime.

  • A structured value for List, Set, Map, Tuple or Relation. The elements are first evaluated before the structured value is built.

  • A variable that evaluates to its current value; see pattern variables and variable declarations.

  • A call to a function or constructor:

    • 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.