[rfc-i] Re: ABNF (RFC2234) vs HTTP's augmented BNF syntax (RFC822 + RFC2616)

Bill Fenner fenner at research.att.com
Tue Feb 15 11:08:33 PST 2005


Bruce Lilly writes:
>a. The text specifies that comments must be delimited on their
>   lines by a semicolon, however the ABNF ABNF contains several
>   lines apparently intended as comments that are not so delimited:
>                                  without DQUOTE
>                                  without angles
>                                  last resort
>                                  excluding NUL

These are being fixed in a revision due very shortly.

>c. There is no provision for whitespace before the "rulename"
>   identifier in a rule!

That's right.  ABNF inside documents is expected to be indented
consistently, but the leading whitespace is not part of the
ABNF, it's part of the document.

"
   For visual ease, rule definitions are left aligned.  When a rule
   requires multiple lines, the continuation lines are indented.  The
   left alignment and indentation are relative to the first lines of the
   ABNF rules and need not match the left margin of the document.
"

>d. It has a number of shift/reduce and reduce/reduce conflicts
>   which complicate parsing (LR(1) parsing is precluded, for
>   example).  Consider the legal ABNF:
>a
>=

Not legal - continuation lines begin with white space.

>e. There are some understandable but odd (from a parsing POV)
>   inconsistencies in handling whitespace (including line
>   endings). E.g. while the example above and
>a = b c
>d = f
>   are legal and equivalent,
>a = b c d = f
>   which differs only slightly, is illegal.

This is intentional; a rule begins on a new line.

  Bill


More information about the rfc-interest mailing list