Serial clauses contain zero or more declarations and at least one unit. When more than an unit is present then the value yielded by the last one is the value yielded by the serial clause. For example, in the serial clause:
(int tmp := a; a := b; a / tmp)
The value yielded by the unit a / tmp
is the value yielded by
the serial clause. Sometimes, however, it is useful to have more than
one “exit point” in a serial clause. For example:
begin int tmp := a; a := b; if tmp = 0 then divbyzero fi; a / temp exit divbyzero: 0 end
When the unit a / temp
in the serial clause above gets
elaborated, the fact it is separated from the next phrase by an
exit
rather than a go-on symbol
(semicolon) marks it as an exit point and therefore as a
mode-unit
or expression rather than a statement to be
voided. The syntax mandates that an exit
shall always be
followed by a label.
A completer is the combination of an exit followed by a label.
exit
label:
The units preceding a completer in a serial clause are
mode-units
, i.e. expressions. In contrast, other
units in the serial clause but the last one are void-units
,
also known as statements.
Note that enquiry clauses are not allowed to contain labels, and therefore they can’t contain completers. This is to prevent code in if-parts, else-parts and do-parts to jump back to the enquiry clause of their enclosed clause.