Appendix D. A Tutorial D Grammar
For purposes of reference, this appendix gives a BNF grammar for Tutorial D relational expressions and assignments (nonrelational operations are mostly omitted, as are definitional operations such as those used to define types, base relvars, views, and constraints). The following are also omitted:
TUPLE FROM, because it doesn’t return a relation
THE_ operators and <attribute name> FROM, because these operators too don’t return relations (except in the unusual special case where the specified possrep component or attribute, as applicable, happens to be relation valued)
DIVIDEBY and SUMMARIZE, because (as explained in Chapter 7) these operators are both somewhat deprecated
Also, the grammar is simplified in certain respects. In particular, it makes no attempt to say where image relations can and can’t be used, nor does it pay any attention to operator precedence rules. (As a result of this latter point, certain constructs permitted by the grammar—for example, the expression r1 MINUS r2 MINUS r3—are potentially ambiguous. Additional syntax rules are needed to resolve such issues, but such rules are omitted here. Of course, parentheses can always be used to guarantee a desired order of evaluation anyway.) A few points of detail:
The shorthand exp is used as an abbreviation for expression.
All syntactic categories of the form <... name> are assumed to be <identifier>s and are defined no further here.
The categories <tuple exp> and <bool exp> are also left undefined—though ...