Re: What does this mean?

From: Jonathan Leffler <jleffler_at_earthlink.net>
Date: Thu, 01 Aug 2002 06:06:13 GMT
Message-ID: <3D48CFBD.7050204_at_earthlink.net>


John Eggert wrote:

> In Date's "manifesto" and "introduction to databases systems" he uses the
> following format
>
> <foo> ::=
> <bar>
>
> Could someone translate that into english for me?
>
> I.E. what the heck does ::= mean?

It's a variation on BNF - Backus-Naur Form (or sometimes Backus Normal Form), which was originally devised to describe the grammar of Algol 60, I believe.

The ::= means 'is defined as'; it means that the thing on the left (always a single item) is defined as the things on the right in the sequence shown.

In this case, a <foo> is made up of a <bar> -- in the example shown, that's all, but often you find that there are extended lists of things on the RHS of the 'production'.

Here is some more BNF, from the SQL-92 standard (though the SQL-99 standard

is very similar); it is some stuff I happen to have lying around:

<identifier> ::=

        [<introducer><character set specification>] <actual identifier>

<actual identifier> ::=

        <regular identifier>
    | <delimited identifier>

<delimited identifier> ::=

        <double quote> <delimited identifier body> <double quote>

<delimited identifier body> ::=

        <delimited identifier part>...

<delimited identifier part> ::=

        <nondoublequote character>
    | <doublequote symbol>

Here we have an SQL identifier defined as 'optionally an introducer and a character set specification, followed by an actual identifier' -- the square brackets surround optional items. And an actual identifier is either a regular identifier or a delimited identifier -- the pipe symbol is used to separate alternatives. This fragment does not further define introducer (actually an underscore character) or a character set specification, or a regular identifier. It does go on to define a delimited identifier in terms of a double quote, a delimited identifier body and another double quote. And so on. In this particular dialect of BNF, the triple dot indicates one or more instances of the construct before the triple dot -- other dialects use other notations, often an asterisk, for the same thing.

See also the web site http://www.cl.cam.ac.uk/~mgk25/iso-ebnf.html which discusses the ISO 14977:1996 Extended BNF, which I've never actually seen used.

-- 
Jonathan Leffler                   #include <disclaimer.h>
Email: jleffler_at_earthlink.net, jleffler_at_us.ibm.com
Guardian of DBD::Informix 1.00.PC2 -- http://dbi.perl.org/
Received on Thu Aug 01 2002 - 08:06:13 CEST

Original text of this message