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:
-
number
A real number.
integer
An integer number.
string
A string.
var-name
A single variable name.
=
, /
, +
, -
, etc.
Operators and punctuators.
.
The end of the command. This is not necessarily an actual dot in the
syntax file (see Forming commands of tokens).
-
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:
-
var-list
A list of one or more variable names or the keyword ALL
.
expression
An expression. See Mathematical 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
that command.