previous up contents next
Left: Syntax Up: Syntax Right: Right-hand-side expressions

Lexical tokens

 The syntax of DATR distinguishes four classes of lexical token: nodes, atoms, variables and reserved symbols. The complete list of reserved symbols is as follows:
    : " < > = == . ' % #
We have already seen the use of the first seven of these. Single quotes can be used to form atoms that would otherwise be ill-formed as such; % is used for end-of-line comments, following the Prolog convention; # is used to introduce declarations and other compiler directives (see Section 3.5, below).

The other classes, nodes, atoms and variables, must be distinct, and distinct from the reserved symbols, but are otherwise arbitrary (ormally, we require them to be finite classes, but this is not of great significance here). For this discussion, we have already adopted the convention that both nodes and atoms are simple words, with nodes starting with uppercase letters. We extend this convention to variables, discussed more fully in Section 3.4 below, which we require to start with the character $. And we take white-space (spaces, newlines, tabs, etc.) to delimit lexical tokens but otherwise to be insignificant.


Copyright © Roger Evans, Gerald Gazdar & Bill Keller, Tuesday 10 November 1998