BNF -- Backus Naur Form
BNF was introduced by John Backus to the Algol 60 committee
and Pete Naur worked with him to define a tool for defining
Algol 60:
[ algol60.syntax.html ]
Since then various extensions to BNF have appeared in every programming languages reference manual.
Most post-Algol-60 languages have used a form of BNF which is simpler to use. They typically remove the diamond brackets from non-terminal symbols and use either quotes or typography to indicate terminal symbols. The "double-colon-equals" is often reduced to an equals sign or a colon. Braces and square brackets are added to indicate repetitive and optional structures.
For example, instead of the BNF definition of an Algol 60 identifier:
one would write in most EBNF's:
Here [ ebnf.pdf ] is a 23 page chapter on one form of EBNF.
ISO-EBNF -- Standard Extended BNF
There is now an international standard EBNF, see
[ iso-ebnf.html ]
for the draft (like all standards you have to pay for the final
version). It seems to have inherited (via Roger Scowen?) many
notations from BS6154. here is identifier
Notice the use of "," and ";" above.
The following notes (in XBNF) come from a 1996 draft.
| Priority | Symbol |
|---|---|
| Do first | * |
| 2nd | - |
| 3rd | , |
| 4th | | |
| 5th | = |
| Last | ; |
Comments are also used to indicate certain symbols such as white space.
| Open | Close | Contains |
|---|---|---|
| ' | ' | no ' |
| " | " | no " |
| ? | ? | no ? |
| (* | *) | comment characters |
| ( | ) | definitions_list |
| [ | ] | definitions_list |
| { | } | definitions_list |
. . . . . . . . . ( end of section Normal Standard EBNF metasymbols) <<Contents | End>>
. . . . . . . . . ( end of section EBNF -- Extended BNF) <<Contents | End>>
eXtreme BNF
XBNF is my own eXtreme BNF that tries to extend BNF to the maximum
possible.
Most of my sample documents
[ http://csci.csusb.edu/dick/samples/ ]
are written using XBNF. It uses brackets and braces as in mathematics and
has special operators for repetitions(#) and option(O).
There is a tool [ mth2html ] which runs on most Unix platforms and generates HTML pages from XBNF documents. For examples
mth2html ebnf.mthgenerates ebnf.html and ebnf.txt ready to be published on the web.
For more see [ intro_ebnf.html ] and [ XBNF in BS Syntactic Meta Language ] below.
XBNF is itself a subset of a powerful formal language (MATHS) designed for expressing all discrete mathematics in ASCII [ math.syntax.html ] that I created back in the late 1980's. For a discussion of how far you can extend BNF before it breaks, see [ rjb99g.xbnf.html ] in an unpublished paper.
Some special definitions used to simplify XBNF:
. . . . . . . . . ( end of section Syntactic meta-languages: BNF, BS6154, XBNF, ISO-EBNF) <<Contents | End>>