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.
  • 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.
  • 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.
  • An Any expression.
  • An All expression.
  • Some statements like If, For, While and Do can also be used in expressions, see StatementAsExpression.
Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit