CADiZ

Reference manual / Concrete syntax / Syntactic metalanguage


Syntactic metalanguage is used in documenting the characters, lexis and syntax of languages. It is sometimes known as BNF, of which there are many dialects. The dialect used in this documentation is a subset of that of ISO/IEC 14977, with modifications to ease the presentation of mathematical symbols.

Here is an example from the lexis.

WORD = WORDPART , { WORDPART }
| ( LETTER | ( DIGIT - DECIMAL ) ) , ALPHASTR , { WORDPART }
| SYMBOL , SYMBOLSTR , { WORDPART }
;

This example defines the non-terminal WORD as including any of three alternative notations. The first alternative comprises one-or-more WORDPARTs. (One-or-more is defined by concatenating one with zero-or-more.) The second alternative begins with either a LETTER or a non-decimal DIGIT, then has an ALPHASTR, and then zero-or-more WORDPARTs. The third alternative begins with a SYMBOL, then has a SYMBOLSTR, and then zero-or-more WORDPARTs.

The syntactic metalanguage used in this documentation is as follows.

_ = _ defines a non-terminal on its left in terms of the syntax on its right
_ | _ separates alternatives
_ , _ separates notations to be concatenated
_  -  _ separates notation on the left from notation to be excepted on the right
{ _ } delimit notation to be repeated zero or more times
[ _ ] delimit optional notation
( _ ) are grouping brackets (parentheses)
' _ ' delimit a terminal symbol
_ ; terminates a definition
? _ ? delimit informal definition of notation
(* _ *) delimit commentary

The _ , _ operator has a higher precedence than the _ | _ operator. All uses of the exception notation (_  -  _) are parenthesized.


IT 23-Nov-2001