Subsections

- Exercises

# Enclosed clauses

There are nine kinds of enclosed clause, most of which we have already met.11.2

1. The simplest is the closed clause which consists of a serial clause enclosed in parentheses (or `BEGIN` and `END`). The range of any identifiers declared in the closed clause is limited to the closed clause. The a68toc compiler limits the use of any identifiers declared in the closed clause to the closed clause at and after their declaration. Here are some examples of closed clauses:

          (3)
          BEGIN p + 3 END
          (INT s;  read(s);  s)
          (REAL q:=i+2;  sqrt(q))

2. Collateral clauses look like row-displays: there must be at least two units. Remember that declarations are not units. The units are elaborated collaterally. This means that the order is undefined and may well be in parallel. Examples of collateral clauses are11.3

          (m:=3, n:=-2)
          ((INT m:=2; m),(CHAR a=REPR i; a))

   The second collateral clause has two units each of which is a closed clause. A parallel clause looks exactly like a collateral clause preceded by `PAR`. The constituent units (there must be at least two) are executed in parallel.11.4

The other enclosed clauses have already been discussed:

1. row-display in section 3.1.1
2. loop clause in section 3.7
3. conditional clause in section 4.5
4. case clause in section 4.6
5. structure-display in section 7.1
6. conformity clause in section 8.3

It should be noted that the enquiry clause (in a conditional- or case-clause) is in a meek context whatever the context of the whole clause. Thus, the context of the clause is passed on only to the final phrase (it must be a unit) in the `THEN`, `ELSE`, `IN` or `OUT` clauses.

## Exercises

10.4
  What kind of enclosed clause could each of the following be? Ans
  (a)
    `((INT p:=ENTIER-4.7; p),37.5)`

  (b)
    `PAR BEGIN 3, 15 END`

  (c)
    `(i|3,-3|4)`

  (d)
    `(si|(INT i): i,(STRING i): i)`

  (e)
    `(a < 3|4|5)`

  (f)
    `(a:=2; b:=-a)`