details from the Paul Klee notebook
details from the Paul Klee notebook

Expressions can be used to compute delay, period, local tempo, breakpoints in specification, and arguments of internal commands and external messages sent to the environment. Expressions are evaluated into values and this evaluation is supposed to take no time.

In this chapter

Expressions versus Actions

Actions and expressions belongs to two clearly separated worlds in Antescofo:

This separation may appear sometimes somewhat artificial. For example, the assignment of a variable is an action (because it can trigger activities or alter synchronization or tempo information) but some variables are only introduced to store intermediate values in the computation of a complex expression. The Loop construct is an action but it is useful to implement iterative expressions. A process definition is a value (of type proc) and a handle to the current execution of a compound action is also a value (an exec). Etc.

To make the boundary between the two worlds more permeable, and to take into account the usual syntax of Max or PD message (they have no delimeters between arguments and the end of line is used as terminator), the Antescofo syntax distinguishes between three kinds of expressions. This distinction is only useful for syntactic reasons: they are not allowed to appear anywhere to make the parsing non-ambiguous but expressions ‟have the same rights” and are managed in the same way, irrespectively of their kind.

Three Kinds of Expressions

Expressions are categorized in three kinds of increasing generality, each including the previous one:

three kinds of expressions

We stress again that these three categories exist only to make the parsing of an augmented score non-ambiguous. Expressions have the same status and are managed in the same way, irrespective of their category. So it is possible to turn an expression of a more general category into an equivalent expression of a less general one:

Auto-Delimited Expressions

Closed expressions, also called auto-delimited expressions, are expressions that are allowed in specific locations:

If a simple or an extended expression is provided where an auto-delimited expression is required, a syntax error is declared.

Numeric constants and strings are closed expressions, as well as map definitions. Tab definitions are closed expressions but the keyword TAB is mandatory. A variable is a closed expression too.

Notice that every expression between parentheses is an auto-delimited expression. So, a rule of thumb is to put the expressions in the contexts listed above between braces when the expression is more complex than a scalar constant or a variable.

The section syntax of auto-delimited expressions gives the full syntax of closed expressions and explains the motivations of these syntactic constraints.

Simple Expressions

Simple expressions include:

and a combination thereof. A simple expression between parentheses is a closed expression (and a simple expression).

The grammar of simple expressions is defined in simple expression grammar.

Extended Expressions

Writing large expressions can be cumbersome and may involve the repetition of common sub-expressions. Functions can be used to avoid the repeated evaluations of common sub-expressions. In addition, the body of a function is an extended expression, which is a sequence of simple expressions enriched with local variables, messages, assignments and loops.

Extended expressions enable a more concise and more readable specification of expressions. See chapter Functions.

Next, we introduce the general notion of value.

You may also go directly to:

  1. For instance, the implementation of a Group implies a state to maintain an environment accessible by the group's childs, it requires a scheduler to manage the delay, additional computation for the management of synchronization and the translation of relative delays into physical time, etc. Even if a compound action performs instantaneously, its execution is a little more costly than its corresponding expression. 

  2. The term closed expression usually refers to an expression that contains no free variables. This is not the meaning used here. A closed expressions refer here to expressions that can be put in sequence without ambiguity. See paragraph auto-delimited expressions