ISO 10303-21:2016(E)
Annex B
(normative)
WSN notational conventions
The syntax of the exchange structure is defined in Wirth Syntax
Notation (WSN) as published by Niklaus Wirth in Communications of the
ACM, 20:11 (Nov 77), 822-823. The WSN consists of a set of productions
or substitution rules. The element given on the left side of a
production (i.e. before the equals sign) can be used to represent an
occurrence of the pattern given on the right side. Elementary terms
that appear only on the right side of such productions are called
terminals. Elements that occur on the left side of a production are
called non-terminals.
The notational conventions are given below. Table B.1 presents WSN
defined in itself.
- a string in capital letters is an element of the
language; the string is the name of the element (for
convenience, small letters are used for undefined identifiers
and commentary);
- any string enclosed in quotation marks is literally what
is contained within the quotation marks. The one exception to
this rule is a quotation mark within a literal. To accomplish
this, the quotation mark is immediately repeated once. The
sequence """" is interpreted as ", and the
sequence "AB""C" is interpreted as AB"C.
- the equals sign "=" indicates a production. The
element on the left is defined to be the combination of the elements
on the right. Any spaces appearing between the elements of a
production are meaningless unless they appear within a literal. A
production is terminated by a full stop ".";
- curly brackets "{ }" indicates zero or more
repetitions;
- square brackets "[ ]" indicate optional
parameters;
- vertical line "|" indicates the logical OR;
- parentheses "(" ")" indicate priority
operations. In particular, where they enclose elements separated
by vertical lines, one of the elements is to be chosen in
conjunction with any other operation.
EXAMPLE The sequence
"A(B|C|D)" is equivalent to "AB|AC|AD"
Table B.1 — Wirth Syntax Notation (WSN) defined in itself
SYNTAX = { PRODUCTION }.
PRODUCTION = IDENTIFIER "=" EXPRESSION ".".
EXPRESSION = TERM { "|" TERM }.
TERM = FACTOR { FACTOR }.
FACTOR = IDENTIFIER
| LITERAL
| "[" EXPRESSION "]"
| "(" EXPRESSION ")"
| "{" EXPRESSION "}" .
IDENTIFIER = letter { letter }.
LITERAL = """" character { character } """".
|