Structure modes consist on one or more fields, each of which have a mode on their own and a name. For example, this is how we would declare a mode for a node in a linked list:
node = struct (int id, real weight, ref node next);
The names of the fields in the structure, id
, weight
and
next
, are known as field selectors of the structure mode.
Field selectors look like identifiers and are formed using the same
rules, but they are not identifiers: they cannot be used on their own,
and can only appear in a program text as part of a selection,
like in next of node
.
Note that the field selectors are integral part of the structure mode.
The two structure modes struct (int a, int b)
and
struct (int x, int y)
are different modes, since
the field selectors of their fields are different. All the fields in
a structure mode must feature a field selector: there is no provision
in the language for “anonymous” fields.
Simplified [RR 4.6.1.d]:
d) structured with FIELDS mode declarator: structure token, FIELDS portrayer of FIELDS brief pack.
Simplified [RR 1.2.1.I:J]:
I) FIELDS :: FIELD ; FIELDS FIELD. J) FIELD :: MODE field TAG.
Note that TAG
is the metanotion that produces identifier
tokens.