ToC DocOverview CGDoc RelNotes Index PermutedIndex
Allegro CL
Home Previous Up Next Table of Contents Index
  1 Introduction   1.4 Definitions   1.4.1 Notational Conventions   1.4.1.2 Modified BNF Syntax

1.4.1.2.1 Splicing in Modified BNF Syntax

The primary extension used is the following:

[[O]]

An expression of this form appears whenever a list of elements is to be spliced into a larger structure and the elements can appear in any order. The symbol O represents a description of the syntax of some number of syntactic elements to be spliced; that description must be of the form

O1 |  ...  | Ol

where each Oi can be of the form S or of the form S* or of the form S1. The expression [[O]] means that a list of the form

(Oi1 ... Oij)  1 <= j

is spliced into the enclosing expression, such that if n <> m and 1 <= n,m <= j, then either Oin <> Oim or Oin = Oim = Qk, where for some 1 <= k <= n, Ok is of the form Qk*. Furthermore, for each Oin that is of the form Qk, that element is required to appear somewhere in the list to be spliced.

For example, the expression

(x [[A | B* | C]] y)

means that at most one A, any number of B's, and at most one C can occur in any order. It is a description of any of these:

 (x y)
 (x B A C y)
 (x A B B B B B C y)
 (x C B A B B B y)

but not any of these:

 (x B B A A C C y)
 (x C B C y)

In the first case, both A and C appear too often, and in the second case C appears too often.

The notation [[O1 | O2 | ... ]]+ adds the additional restriction that at least one item from among the possible choices must be used. For example:

(x [[A | B* | C]]+ y)

means that at most one A, any number of B's, and at most one C can occur in any order, but that in any case at least one of these options must be selected. It is a description of any of these:

 (x B y)
 (x B A C y)
 (x A B B B B B C y)
 (x C B A B B B y)

but not any of these:

 (x y)
 (x B B A A C C y)
 (x C B C y)

In the first case, no item was used; in the second case, both A and C appear too often; and in the third case C appears too often.

Also, the expression:

(x [[A | B | C]] y)

can generate exactly these and no others:

 (x A B C y)
 (x A C B y)
 (x A B y)
 (x B A C y)
 (x B C A y)
 (x B A y)
 (x C A B y)
 (x C B A y)


Home Previous Up Next Table of Contents Index
© Franz Inc. All Rights Reserved - File last updated 2022-07-25