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> </td><th width="60%" align="center">B</th><td width="20%" align="right"> <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·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/>
|
||
<postal-address> ::= <name-part> <street-address> <zip-part><br/>
|
||
<br/>
|
||
<personal-part> ::= <name> | <initial> "."<br/>
|
||
<br/>
|
||
<name-part> ::= <personal-part> <last-name> [<jr-part>] <EOL><br/>
|
||
| <personal-part> <name-part><br/>
|
||
<br/>
|
||
<street-address> ::= [<apt>] <house-num> <street-name> <EOL><br/>
|
||
<br/>
|
||
<zip-part> ::= <town-name> "," <state-code> <ZIP-code> <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> </td><td width="20%" align="center"><a accesskey="u" href="../B.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="boa.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">blurgle </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> boa</td></tr></table></div></body></html>
|