ietf-nntp Detailed syntax

Paul Overell paulo at turnpike.com
Fri Jan 4 02:03:04 PST 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In message <20020103175813.C67868 at demon.net>, Clive D.W. Feather 
<clive at demon.net> writes
>Okay, here's my review of the formal syntax.
>
>For readability, change WSP to:
>
>    WSP = 1*(SP / HT)
>
>meaning that all "1*WSP" can just change to "WSP", and add a definition
>
>    LE = *WSP CRLF
>
>(LE meaning "line end"), which allows you simplify all those commands
>to end LE instead of 1*WSP CRLF. This has the benefit of making it clear
>that all commands have the same line ending and none are special.
>
>Alternatively, since this sequence is only used for command ends and all
>commands end that way, make the root productions:
>
>        command-line = command *WSP CRLF


Or use

          command-line = command [WSP] CRLF

Which I think is clearer and also gives an unambiguous parse (not that 
that is important here)


>
>If you make all these changes, plus some minor tidying of the line wraps,
>you get the following syntax, which I hope people find is more readable.
>

Looks good.

>
>  13  Augmented BNF Syntax for NNTP Commands
>
>     This syntax defines the non-terminal "command-line". It is
>     listed in alphabetical order. Note that ABNF strings are case
>     insensitive.
>
>        article-command = "ARTICLE" [WSP (msg-id /
>            article-number)]
>        article-number = 1*16DIGIT
>        argument = 1*(%x21-7E / UTF-8-non-ascii)
>        body-command = "BODY" [WSP (msg-id / article-number)]
>        command = article-command /
>            body-command /
>            date-command /
>            group-command /
>            hdr-command /
>            head-command /
>            help-command /
>            ihave-command /
>            last-command /
>            list-active-command /
>            list-active-times-command /
>            list-distrib-pats-command /
>            list-distributions-command /
>            list-extensions-command /
>            list-newsgroups-command /
>            list-overview-fmt-command /
>            listgroup-command /
>            mode-reader-command /
>            newgroups-command /
>            newnews-command /
>            next-command /
>            over-command /
>            post-command /
>            quit-command /
>            stat-command /
>            x-command
>        command-line = command *WSP CRLF

          command-line = command [WSP] CRLF

>        CR = %x0D
>        CRLF = CR LF
>        date-command = "DATE"
>        date-time = date WSP time [WSP "GMT"]
>        date = [2DIGIT] 6DIGIT
>        DIGIT = %x30-39
>        group-command = "GROUP" WSP group-name
>        group-name = 1*wildmat-exact
>        hdr-command = "HDR" WSP header WSP (range / msg-id)
>        head-command = "HEAD" [WSP (msg-id / article-number)]
>        header = 1*header-char
>        header-char = %x21-39 / %x3B-7E ; exclude SP and :
>        help-command = "HELP"
>        HT = %x09
>        ihave-command = "IHAVE" WSP msg-id
>        last-command = "LAST"
>        LF = %x0A
>        list-active-command = "LIST" [WSP "ACTIVE" [WSP wildmat]]
>        list-active-times-command = "LIST" WSP "ACTIVE.TIMES"
>            [WSP wildmat]
>        list-distrib-pats-command = "LIST" WSP "DISTRIB.PATS"
>        list-distributions-command = "LIST" WSP "DISTRIBUTIONS"
>        list-extensions-command = "LIST" WSP "EXTENSIONS"
>        list-newsgroups-command = "LIST" WSP "NEWSGROUPS"
>            [WSP wildmat]
>        list-overview-fmt-command = "LIST" WSP "OVERVIEW.FMT"
>        listgroup-command = "LISTGROUP" [WSP group-name]
>        mode-reader-command = "MODE" WSP "READER"
>        msg-id = "<" 1*248msg-id-char ">"
>            ; subject to the requirements of section 9.1
>        msg-id-char = %x21-3B / %x3C / %x3E-7E ; exclude SP < >
>        newgroups-command = "NEWGROUPS" WSP date-time
>        newnews-command = "NEWNEWS" WSP wildmat WSP date-time
>        next-command = "NEXT"
>        over-command = "OVER" [WSP range]
>        post-command = "POST"
>        quit-command = "QUIT"
>        range = article-number ["-" [article-number]]
>        SP = %x20
>        stat-command = "STAT" [WSP (msg-id / article-number)]
>        time = 6DIGIT
>        UTF-8-non-ascii = UTF8-2 / UTF8-3 / UTF8-4 / UTF8-5 /
>            UTF8-6
>        UTF8-1 = %x80-BF
>        UTF8-2 = %xC0-DF UTF8-1
>        UTF8-3 = %xE0-EF 2UTF8-1
>        UTF8-4 = %xF0-F7 3UTF8-1
>        UTF8-5 = %xF8-FB 4UTF8-1
>        UTF8-6 = %xFC-FD 5UTF8-1
>        wildmat = wildmat-pattern *("," ["!"] wildmat-pattern)
>        wildmat-pattern = 1*wildmat-item
>        wildmat-item = wildmat-exact / wildmat-wild
>        wildmat-exact = %x21-29 / %x2B / %x2D-3E / %x40-5A /
>            %x5E-7E / UTF-8-non-ascii  ; exclude * , ? [ \ ]
>        wildmat-wild = "*" / "?"
>        WSP = 1*(SP / HT)
>        x-command = x-command-name *(WSP argument)
>            ; detailed syntax defined outside this memo
>        x-command-name = 3*12%x21-7E
>
>
>Finally, though I haven't done it here, I think that alphabetical order
>isn't the best choice. In particular, I would put command-line followed by
>command at the top, then all the xxx-commands, then the other lowercase
>names, and finally the uppercase ones. YMMV.
>

Having spend many frustrating hours over the years searching for 
particular productions in non-alphabetical syntaxes - I strongly 
disagree.

Syntax is not read as prose from top to bottom but by production, so 
being able to quickly find a particular production is important.

One author's "logical" order is another's random mess - please keep it 
alphabetical!


Regards
- -- 
Paul Overell                                             T U R N P I K E

-----BEGIN PGP SIGNATURE-----
Version: PGPsdk 2.0.5

iQA/AwUBPDV91x8WRy+wdge+EQJCMwCfVPFJ4GGfHy0SVZ8i/AVLY3T17u8An3vl
QtqvphdbpfpKXzcjvH2Iqqd1
=bJE6
-----END PGP SIGNATURE-----



More information about the ietf-nntp mailing list