Augmented Backus–Naur form

In computer science, augmented Backus–Naur form (ABNF) is a metalanguage based on Backus–Naur form (BNF) but consisting of its own syntax and derivation rules. The motive principle for ABNF is to describe a formal system of a language to be used as a bidirectional communications protocol. It is defined by Internet Standard 68 ("STD 68", type case sic), which as of December 2010 was RFC 5234, and it often serves as the definition language for IETF communication protocols.[1][2]

RFC 5234 supersedes RFC 4234, 2234 and 733.[3] RFC 7405 updates it, adding a syntax for specifying case-sensitive string literals.

Overview

ABNF syntax diagram of ABNF rules
ABNF syntax diagram of ABNF rules

An ABNF specification is a set of derivation rules, written as

rule = definition; comment CR LF

where rule is a case-insensitive nonterminal, the definition consists of sequences of symbols that define the rule, a comment for documentation, and ending with a carriage return and line feed.

Rule names are case-insensitive: <rulename>, <Rulename>, <RULENAME>, and <rUlENamE> all refer to the same rule. Rule names consist of a letter followed by letters, numbers, and hyphens.

Angle brackets (<, >) are not required around rule names (as they are in BNF). However, they may be used to delimit a rule name when used in prose to discern a rule name.

Terminal values

Terminals are specified by one or more numeric characters.

Numeric characters may be specified as the percent sign %, followed by the base (b = binary, d = decimal, and x = hexadecimal), followed by the value, or concatenation of values (indicated by .). For example, a carriage return is specified by %d13 in decimal or %x0D in hexadecimal. A carriage return followed by a line feed may be specified with concatenation as %d13.10.

Literal text is specified through the use of a string enclosed in quotation marks ("). These strings are case-insensitive, and the character set used is (US-)ASCII. Therefore, the string "abc" will match “abc”, “Abc”, “aBc”, “abC”, “ABc”, “AbC”, “aBC”, and “ABC”. RFC 7405 added a syntax for case-sensitive strings: %s"aBc" will only match "aBc". Prior to that, a case-sensitive string could only be specified by listing the individual characters: to match “aBc”, the definition would be %d97.66.99. A string can also be explicitly specified as case-insensitive with a %i prefix.

Operators

White space

White space is used to separate elements of a definition; for space to be recognized as a delimiter, it must be explicitly included. The explicit reference for a single whitespace character is WSP (linear white space), and LWSP is for zero or more whitespace characters with newlines permitted. The LWSP definition in RFC5234 is controversial[4] because at least one whitespace character is needed to form a delimiter between two fields.

Definitions are left-aligned. When multiple lines are required (for readability), continuation lines are indented by whitespace.

Comment

; comment

A semicolon (;) starts a comment that continues to the end of the line.

Concatenation

Rule1 Rule2

A rule may be defined by listing a sequence of rule names.

To match the string “aba”, the following rules could be used:

  • fu = %x61 ; a
  • bar = %x62 ; b
  • mumble = fu bar fu

Alternative

Rule1 / Rule2

A rule may be defined by a list of alternative rules separated by a solidus (/).

To accept the rule fu or the rule bar, the following rule could be constructed:

  • fubar = fu / bar

Incremental alternatives

Rule1 =/ Rule2

Additional alternatives may be added to a rule through the use of =/ between the rule name and the definition.

The rule

  • ruleset = alt1 / alt2
  • ruleset =/ alt3
  • ruleset =/ alt4 / alt5

is therefore equivalent to

  • ruleset = alt1 / alt2 / alt3 / alt4 / alt5

Value range

%c##-##

A range of numeric values may be specified through the use of a hyphen (-).

The rule

  • OCTAL = %x30-37

is equivalent to

  • OCTAL = "0" / "1" / "2" / "3" / "4" / "5" / "6" / "7"

Sequence group

(Rule1 Rule2)

Elements may be placed in parentheses to group rules in a definition.

To match "a b d" or "a c d", the following rule could be constructed:

  • group = a (b / c) d

To match “a b” or “c d”, the following rules could be constructed:

  • group = a b / c d
  • group = (a b) / (c d)

Variable repetition

n*nRule

To indicate repetition of an element, the form <a>*<b>element is used. The optional <a> gives the minimal number of elements to be included (with the default of 0). The optional <b> gives the maximal number of elements to be included (with the default of infinity).

Use *element for zero or more elements, *1element for zero or one element, 1*element for one or more elements, and 2*3element for two or three elements, cf. regular expressions e*, e?, e+ and e{2,3}.

Specific repetition

nRule

To indicate an explicit number of elements, the form <a>element is used and is equivalent to <a>*<a>element.

Use 2DIGIT to get two numeric digits, and 3DIGIT to get three numeric digits. (DIGIT is defined below under "Core rules". Also see zip-code in the example below.)

Optional sequence

[Rule]

To indicate an optional element, the following constructions are equivalent:

  • [fubar snafu]
  • *1(fubar snafu)
  • 0*1(fubar snafu)

Operator precedence

The following operators have the given precedence from tightest binding to loosest binding:

  1. Strings, names formation
  2. Comment
  3. Value range
  4. Repetition
  5. Grouping, optional
  6. Concatenation
  7. Alternative

Use of the alternative operator with concatenation may be confusing, and it is recommended that grouping be used to make explicit concatenation groups.

Core rules

ABNF syntax diagram of core rules
ABNF syntax diagram of core rules

The core rules are defined in the ABNF standard.

Rule Formal definition Meaning
ALPHA %x41%x5A / %x61%x7A Upper- and lower-case ASCII letters (A–Z, a–z)
DIGIT %x3039 Decimal digits (0–9)
HEXDIG DIGIT / "A" / "B" / "C" / "D" / "E" / "F" Hexadecimal digits (0–9, A–F, a–f)
DQUOTE %x22 Double quote
SP %x20 Space
HTAB %x09 Horizontal tab
WSP SP / HTAB Space and horizontal tab
LWSP *(WSP / CRLF WSP) Linear white space (past newline)
VCHAR %x21%x7E Visible (printing) characters
CHAR %x01%x7F Any ASCII character, excluding NUL
OCTET %x00%xFF 8 bits of data
CTL %x00%x1F / %x7F Controls
CR %x0D Carriage return
LF %x0A Linefeed
CRLF CR LF Internet-standard newline
BIT "0" / "1" Binary digit

Note that in the core rules diagram the CHAR2 charset is inlined in char-val and CHAR3 is inlined in prose-val in the RFC spec. They are named here for clarity in the main syntax diagram.

Example

The (U.S.) postal address example given in the augmented Backus–Naur form (ABNF) page may be specified as follows:

postal-address   = name-part street zip-part

name-part        = *(personal-part SP) last-name [SP suffix] CRLF
name-part        =/ personal-part CRLF

personal-part    = first-name / (initial ".")
first-name       = *ALPHA
initial          = ALPHA
last-name        = *ALPHA
suffix           = ("Jr." / "Sr." / 1*("I" / "V" / "X"))

street           = [apt SP] house-num SP street-name CRLF
apt              = 1*4DIGIT
house-num        = 1*8(DIGIT / ALPHA)
street-name      = 1*VCHAR

zip-part         = town-name "," SP state 1*2SP zip-code CRLF
town-name        = 1*(ALPHA / SP)
state            = 2ALPHA
zip-code         = 5DIGIT ["-" 4DIGIT]

Pitfalls

RFC 5234 adds a warning in conjunction to the definition of LWSP as follows:

Use of this linear-white-space rule permits lines containing only white space that are no longer legal in mail headers and have caused interoperability problems in other contexts. Do not use when defining mail headers and use with caution in other contexts.

References

  1. ^ "Official Internet Protocol Standards". RFC Editor. 2010-02-21. Archived from the original on 9 February 2010. Retrieved 2010-02-21.
  2. ^ Crocker, D.; Overell, P. (January 2008). "Augmented BNF for Syntax Specifications: ABNF" (plain text). RFC Editor. p. 16. Retrieved 2010-02-21.
  3. ^ "RFC Index". RFC Editor. 2010-02-19. Archived from the original on 9 February 2010. Retrieved 2010-02-21.
  4. ^ RFC Errata 3096.

Read other articles:

Alexey Ivanovich SudayevLahirAlexey Ivanovich Sudayev(1912-08-23)23 Agustus 1912Leningrad, RusiaMeninggal17 Agustus 1946(1946-08-17) (umur 33)Leningrad, RusiaPekerjaanPenemu, Insinyur Alexey Ivanovich Sudayev atau Anatoly Arkadaevich Blagonravov (Rusia: Алексей Иванович Судаев) (23 Agustus 1912 - 17 Agustus 1946) adalah seorang desainer senjata Rusia. Dia menciptakan Pistol mitraliur PPS dan senapan serbu AS-44. Dia tinggal di Leningrad, dan berpartisipasi dalam per...

 

American dark satirical comedy-drama series HappyishGenre Dark comedy Comedy drama Satire Created byShalom AuslanderWritten byShalom AuslanderStarring Steve Coogan Kathryn Hahn Bradley Whitford Ellen Barkin Hannah Hodson Country of originUnited StatesOriginal languageEnglishNo. of seasons1No. of episodes10ProductionExecutive producers Shalom Auslander Ken Kwapis Alexandra Beattie Camera setupSingle cameraRunning time30 minutesProduction companiesIn Cahoots Showtime NetworksOriginal releaseNet...

 

Bridge in Ontario, CanadaRosedale Valley BridgeCoordinates43°40′21″N 79°22′15″W / 43.67263°N 79.37071°W / 43.67263; -79.37071CarriesLine 2 Bloor–DanforthCrossesRosedale Ravine Rosedale Valley RoadLocaleToronto, Ontario, CanadaOther name(s)Rosedale Ravine BridgeMaintained byToronto Transit CommissionCharacteristicsDesignCovered arch bridgeMaterialSteel and concreteNo. of spans1HistoryConstructed byJohn B. ParkinConstruction start1965Construction end1966Ope...

Lost Ricky Martin Maria Music Video The Wikipedia article for Maria by Ricky Martin, mentions a third music video. Information wasn't present, and any information, some I may have tried to add myself but obviously, without any references, let alone a link to the video, as it is currently missing and considered lost media. I am trying to find a copy of it and I think finding others who can confirm my thoughts may at least help in proving it's real so it is something that can be found. So I th...

 

2022 Indian film PanghrunPromotional release posterDirected byMahesh ManjrekarScreenplay byMahesh ManjrekarGanesh MatkariStory byBalakrishna Bhagwant BorkarProduced byMahesh PatelUmesh KubalParesh MavaniUmesh NathaniVirendra MavaniStarring Gauri Ingawale Amol Bavadekar CinematographyKaran B. RawatEdited bySatish PadvalMusic byHitesh ModakProductioncompaniesZee StudiosMahesh Manjrekar MoviesRelease dates 2018 (2018) (Mumbai Film Festival) 2020 (2020) (Bengaluru International ...

 

この記事は検証可能な参考文献や出典が全く示されていないか、不十分です。出典を追加して記事の信頼性向上にご協力ください。(このテンプレートの使い方)出典検索?: コルク – ニュース · 書籍 · スカラー · CiNii · J-STAGE · NDL · dlib.jp · ジャパンサーチ · TWL(2017年4月) コルクを打ち抜いて作った瓶の栓 コルク(木栓、�...

American animated television series Spirit Riding FreeGenreAdventureBased onSpirit: Stallion of the Cimarronby John FuscoDeveloped byAury WallingtonVoices of Amber Frank Sydney Park Bailey Gambertoglio Darcy Rose Byrnes Nolan North Kari Wahlgren Theme music composerKari Kimmel[1]Opening themeRiding Free, performed by Maisy StellaEnding themeRiding Free (Instrumental)ComposersJoachim Horsley (S1)James Allen Roberson (S2-8)Sunna Wehrmeijer (Pony Tales and Riding Academy)Peter Bateman (P...

 

Part of the LGBT rights seriesLegal status ofsame-sex unions Marriage Andorra Argentina Australia Austria Belgium Brazil Canada Chile Colombia Costa Rica Cuba Denmark Ecuador Estonia Finland France Germany Greece Iceland Ireland Luxembourg Malta Mexico Nepal Netherlands1 New Zealand2 Norway Portugal Slovenia South Africa Spain Sweden Switzerland Taiwan United Kingdom3 United States4 Uruguay Recognized Israel5 Civil unions andregistered partnerships Bolivia Croatia Cyprus Czech Republic Hunga...

 

Konflik TigrayBagian dari Konflik di Tanduk AfrikaKontrol wilayah Tigray per Agustus 2021Tanggal3 November 2020 – 3 November 2022(2 tahun)LokasiRegion Tigray, EtiopiaRegion Amhara, EtiopiaRegion Maekel, EritreaHasil Pemerintah dan TPLF secara resmi menyetujui penghentian permusuhan dan pelucutan senjata yang sistematis dan dapat diverifikasi (2 November 2022)[1][2] Kesepakatan kedua untuk pelaksanaan kesepakatan damai yang ditandatangani kedua belah pihak (12 November 2...

Town in Sousse Governorate, Tunisia This article possibly contains original research. Please improve it by verifying the claims made and adding inline citations. Statements consisting only of original research should be removed. (September 2018) (Learn how and when to remove this message) Place in Sousse Governorate, TunisiaM'saken مساكنMonument in M'saken city center 2012M'sakenLocation in TunisiaCoordinates: 35°44′0″N 10°35′0″E / 35.73333°N 10.58333°E...

 

American think tank in Washington, D.C. Not to be confused with Centre for Strategic and International Studies (Indonesia). This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages) This article contains content that is written like an advertisement. Please help improve it by removing promotional content and inappropriate external links, and by adding encyclopedic content written from a neutral poi...

 

Former position in the Cabinet of the United Kingdom The Secretary of State for Employment was a position in the Cabinet of the United Kingdom. In 1995 it was merged with Secretary of State for Education to make the Secretary of State for Education and Employment. In 2001 the employment functions were hived off and transferred to the Secretary of State for Work and Pensions. Minister of Labour (1916–1940) Name Portrait Term of office Political Party Prime Minister John Hodge 10 December 19...

Убийство в Неммерсдорфе Место Маяковское Координаты 54°31′12″ с. ш. 22°03′56″ в. д.HGЯO Дата 21 октября 1944  Медиафайлы на Викискладе Тела немецких жителей, Неммерсдорф (указана дата снимка 20 октября 1944 года). Убийство в Не́ммерсдо́рфе (нем. Massaker von Nemmersdorf) — собы...

 

East German politician (1909–1973) For the US artist, see Edith Baumann (artist). Edith BaumannEdith Honecker-BaumannBorn(1909-08-01)1 August 1909Prenzlauer Berg, Berlin, Kingdom of Prussia, German EmpireDied7 April 1973(1973-04-07) (aged 63)East Berlin, East GermanyOccupation(s)Political activistYouth leader (FDJ) Party Central Committee memberPolitical partySAPD (1931–1933)SED (1946–1973)Spouse Erich Honecker ​(m. 1947⁠–⁠1953)​Chil...

 

Hungarian politician Pál OrdódyMinister of Public Works and TransportIn office24 April 1880 – 9 August 1882Preceded byGyula SzapárySucceeded byGábor Kemény Personal detailsBorn(1822-08-26)26 August 1822Pest, HungaryDied26 August 1885(1885-08-26) (aged 63)Bad Ischl, Austria-HungaryPolitical partyDeák PartyLiberal PartyProfessionpolitician The native form of this personal name is ordódi és rozsonmiticzi Ordódy Pál. This article uses Western name order when mentioni...

Constantin YpsilántisConstantin YpsilántisBiographieNaissance 1760ConstantinopleDécès 24 juin 1816KievSépulture Laure des Grottes de KievNom dans la langue maternelle Κωνσταντίνος ΥψηλάντηςNationalités principauté de Moldavieprincipauté de ValachieottomaneActivité DrogmanPère Alexandre YpsilántisMère Catherine Mourousi (d)Conjoints Rallou Kallimaki (d)Elisábet Ypsilánti (en)Enfants Elena Ypsilántis (d)Aikaterini Ypsilanti (d)Alexandre YpsilántisDimítrios ...

 

Pour les articles homonymes, voir Niva (homonymie), Lada Sport et Ladaniva. Si ce bandeau n'est plus pertinent, retirez-le. Cliquez ici pour en savoir plus. Cet article ne cite pas suffisamment ses sources (avril 2023). Si vous disposez d'ouvrages ou d'articles de référence ou si vous connaissez des sites web de qualité traitant du thème abordé ici, merci de compléter l'article en donnant les références utiles à sa vérifiabilité et en les liant à la section « Notes et réf�...

 

Bistümer in Kolumbien Die römisch-katholische Kirche in Kolumbien ist Teil der weltweiten römisch-katholischen Kirche. Inhaltsverzeichnis 1 Geschichte 2 Organisation 2.1 Präsidenten der kolumbianischen Bischofskonferenz 3 Bistümer in Kolumbien 4 Siehe auch 5 Weblinks 6 Einzelnachweise Geschichte Am 10. Januar und 24. April 1534 wurden mit Santa Marta und Cartagena die ersten Bistümer Kolumbiens begründet, denen am 22. August 1546 das Bistum Popayán und am 11. September 1562 das Bistum...

Guds tjänareElisabeth av Frankrike Guds tjänareElisabeth av Frankrike Madame Elisabeth av Elisabeth Vigée-LebrunPrinsessan av Frankrike Jungfru och MartyrFödd3 maj 1764Versailles, FrankrikeDöd10 maj 1794 (30 år)Place de la Révolution, Paris, FrankrikeVördas inomRomersk-katolska kyrkanHelgedomKlosterkyrkan Saint-Denis, Saint-Denis, FrankrikeHelgondag10 majAttributMartyrkronaPalmkvistFleur de lisRosenkransenSkyddshelgon förFrankrike Élisabeth-Philippine av Frankrike av Élis...

 

Submarine designed to operate in coordination with other vessels of a battle fleet Gato class fleet submarine USS Wahoo A fleet submarine is a submarine with the speed, range, and endurance to operate as part of a navy's battle fleet. Examples of fleet submarines are the British First World War era K class and the American World War II era Gato class. The term has survived in Britain to refer to modern nuclear-powered attack submarines. In the United States Navy, the term came to be used...