4.10 Backus-Naur Form
The syntax of some parts of the PSPP language is presented in this
manual using the formalism known as Backus-Naur Form, or BNF. The
following table describes BNF:
- Words in all-uppercase are PSPP keyword tokens. In BNF, these are
often called terminals. There are some special terminals, which
are written in lowercase for clarity:
- A real number.
- An integer number.
- A string.
- A single variable name.
- Operators and punctuators.
- The end of the command. This is not necessarily an actual dot in the
syntax file: See Commands, for more details.
- Other words in all lowercase refer to BNF definitions, called
productions. These productions are also known as
nonterminals. Some nonterminals are very common, so they are
defined here in English for clarity:
- A list of one or more variable names or the keyword
- An expression. See Expressions, for details.
- ‘::=’ means “is defined as”. The left side of ‘::=’ gives
the name of the nonterminal being defined. The right side of ‘::=’
gives the definition of that nonterminal. If the right side is empty,
then one possible expansion of that nonterminal is nothing. A BNF
definition is called a production.
- So, the key difference between a terminal and a nonterminal is that a
terminal cannot be broken into smaller parts—in fact, every terminal
is a single token (see Tokens). On the other hand, nonterminals are
composed of a (possibly empty) sequence of terminals and nonterminals.
Thus, terminals indicate the deepest level of syntax description. (In
parsing theory, terminals are the leaves of the parse tree; nonterminals
form the branches.)
- The first nonterminal defined in a set of productions is called the
start symbol. The start symbol defines the entire syntax for