41 lines
4.5 KiB
HTML
41 lines
4.5 KiB
HTML
|
|
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
|
|||
|
|
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>BNF</title><link rel="stylesheet" href="../../jargon.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.61.0"/><link rel="home" href="../index.html" title="The Jargon File"/><link rel="up" href="../B.html" title="B"/><link rel="previous" href="blurgle.html" title="blurgle"/><link rel="next" href="boa.html" title="boa"/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">BNF</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="blurgle.html">Prev</a><EFBFBD></td><th width="60%" align="center">B</th><td width="20%" align="right"><EFBFBD><a accesskey="n" href="boa.html">Next</a></td></tr></table><hr/></div><dt><a id="BNF"/><dt xmlns="" id="BNF"><b>BNF</b>: <span xmlns="http://www.w3.org/1999/xhtml" class="pronunciation">/B<>N<EFBFBD>F/</span>, <span xmlns="http://www.w3.org/1999/xhtml" class="grammar">n.</span></dt></dt><dd><p> 1. [techspeak] Acronym for <span class="firstterm">Backus Normal
|
|||
|
|
Form</span> (later retronymed to <span class="firstterm">Backus-Naur
|
|||
|
|
Form</span> because BNF was not in fact a normal form), a metasyntactic
|
|||
|
|
notation used to specify the syntax of programming languages, command sets,
|
|||
|
|
and the like. Widely used for language descriptions but seldom documented
|
|||
|
|
anywhere, so that it must usually be learned by osmosis from other hackers.
|
|||
|
|
Consider this BNF for a U.S. postal address:</p><div class="literallayout"><p><br/>
|
|||
|
|
<EFBFBD><postal-address><EFBFBD>::=<3D><name-part><EFBFBD><street-address><EFBFBD><zip-part><br/>
|
|||
|
|
<br/>
|
|||
|
|
<EFBFBD><personal-part><EFBFBD>::=<3D><name><EFBFBD>|<7C><initial><EFBFBD>"."<br/>
|
|||
|
|
<br/>
|
|||
|
|
<EFBFBD><name-part><EFBFBD>::=<3D><personal-part><EFBFBD><last-name><EFBFBD>[<jr-part>]<5D><EOL><br/>
|
|||
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>|<7C><personal-part><EFBFBD><name-part><br/>
|
|||
|
|
<br/>
|
|||
|
|
<EFBFBD><street-address><EFBFBD>::=<3D>[<apt>]<5D><house-num><EFBFBD><street-name><EFBFBD><EOL><br/>
|
|||
|
|
<br/>
|
|||
|
|
<EFBFBD><zip-part><EFBFBD>::=<3D><town-name><EFBFBD>","<EFBFBD><state-code><EFBFBD><ZIP-code><EFBFBD><EOL><br/>
|
|||
|
|
</p></div><p>This translates into English as: “<span class="quote">A postal-address consists of
|
|||
|
|
a name-part, followed by a street-address part, followed by a zip-code
|
|||
|
|
part. A personal-part consists of either a first name or an initial
|
|||
|
|
followed by a dot. A name-part consists of either: a personal-part
|
|||
|
|
followed by a last name followed by an optional jr-part (Jr., Sr., or
|
|||
|
|
dynastic number) and end-of-line, or a personal part followed by a name
|
|||
|
|
part (this rule illustrates the use of recursion in BNFs, covering the case
|
|||
|
|
of people who use multiple first and middle names and/or initials). A
|
|||
|
|
street address consists of an optional apartment specifier, followed by a
|
|||
|
|
street number, followed by a street name. A zip-part consists of a
|
|||
|
|
town-name, followed by a comma, followed by a state code, followed by a
|
|||
|
|
ZIP-code followed by an end-of-line.</span>” Note that many things (such as
|
|||
|
|
the format of a personal-part, apartment specifier, or ZIP-code) are left
|
|||
|
|
unspecified. These are presumed to be obvious from context or detailed
|
|||
|
|
somewhere nearby. See also <a href="../P/parse.html"><i class="glossterm">parse</i></a>.</p></dd><dd><p> 2. Any of a number of variants and extensions of BNF proper,
|
|||
|
|
possibly containing some or all of the <a href="../R/regexp.html"><i class="glossterm">regexp</i></a>
|
|||
|
|
wildcards such as <b class="command">*</b> or <b class="command">+</b>. In fact the example above isn't the pure form
|
|||
|
|
invented for the Algol-60 report; it uses <b class="command">[]</b>, which was introduced a few years later in IBM's
|
|||
|
|
PL/I definition but is now universally recognized. </p></dd><dd><p> 3. In <a href="../S/science-fiction-fandom.html"><i class="glossterm">science-fiction fandom</i></a>, a
|
|||
|
|
‘Big-Name Fan’ (someone famous or notorious). Years ago a fan
|
|||
|
|
started handing out black-on-green BNF buttons at SF conventions; this
|
|||
|
|
confused the hacker contingent terribly.</p></dd><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="blurgle.html">Prev</a><EFBFBD></td><td width="20%" align="center"><a accesskey="u" href="../B.html">Up</a></td><td width="40%" align="right"><EFBFBD><a accesskey="n" href="boa.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">blurgle<EFBFBD></td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"><EFBFBD>boa</td></tr></table></div></body></html>
|