PL_TDF Definition

January 1998

next section previous section current document TenDRA home page document index


2.1 - Syntax description
2.2 - Lexical Units
2.3 - Pre-processing

2 Notation


2.1. Syntax description

Words enclosed in angle brackets, < >, form non-terminal symbols. Other symbols and words stand for themselves as terminal symbols. An expansion of a non-terminal is indicated using ::= with its expansion given as a sequence (possibly empty) of terminals and non-terminals. For example:

	<Exp> ::= * <ident>
is a possible expansion of an EXP SORT. If the word for the non-terminal starts with a capital letter then it will be totally described by a set of such expansions; otherwise the expansion of the non-terminal will be given by other methods in the text.

The post-fix -Opt on a non terminal is an abreviation allowing an empty expansion. For example:

	<Access>-Opt
is equivalent to the use of another non-terminal <AccessOption> whose expansions are:

	<AccessOption> ::= 
	<AccessOption> ::= <Access>
The post-fix -List on a non terminal is an abreviation for lists of objects seperated by the ,-symbol. For example:

	<Exp>-List
is equivalent to the use of another non-terminal <ExpList> whose expansions are:

	<ExpList> ::= <Exp>
	<ExpList> ::= <ExpList> , <Exp>
Both of these post-fix notations are also used with sequences of terminals and non-terminals within the angle brackets with the same kind of expansion. In these cases, the expansion within the angle brackets form an anonymous non-terminal.


2.2. Lexical Units

The terminal symbols ( ), [ ], and { } always occur as parenthetic pairs and never form part of other terminal symbols.

The terminal symbols , ; and : are similarly terminators for other terminal symbols.

White space is a terminator for other terminal symbols but is otherwise ignored except in strings.

All other terminal symbols are sequences of ACSII symbols not including the above. These are divided into seven classes: keywords, TDF constructors, operators, <integer_denotation>s, <floating_denotation>s, <string>s and <ident>s.

The keywords and operators are expressed directly in the syntax description. The TDF constructors are those given in the TDF specification which have first-class SORTs as parameters and results.

An <integer_denotatation> allows one to express an integer in any base less than 16, with the default being 10.

	<integer_denotation> ::= <digit>
	<integer_denotation> ::= <integer_denotation> <digit>
	<integer_denotation> ::= <base> <integer_denotation>

	<base> ::= <integer_denotation> r
Examples are 31, 16r1f, 8r37, 2r11111 - all giving the same value.

A <floating_denotation> is an <integer_denotation> followed by the . symbol and a sequence of digits. The radix of the <floating_denotation> is given by the base of its component <integer_denotation>

A <string> is the same as a C string - any sequence of characters within " ". The same C conventions hold for \ within strings for single characters.

A <character> is an string character within ` `. The same \ conventions hold.

An <ident> is any other sequence of characters. They will be used to form names for TAGs, TOKENs, AL_TAGs and LABELs.


2.3. Pre-processing

At the moment there is only one pre-processing directive. A line starting with #include will textually include the following file (named within string quotes), using the same path conventions as C.

Comments may be included in the text using the /* ... */ notation; this differs slightly from the C convention in that comments may be nested.


Part of the TenDRA Web.
Crown Copyright © 1998.