Knowledge

Augmented Backus–Naur form

Source 📝

108: 943: 1491:
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
257:
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
236:
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
1615: 934:
Use of the alternative operator with concatenation may be confusing, and it is recommended that grouping be used to make explicit concatenation groups.
175:) 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. 145:, the definition consists of sequences of symbols that define the rule, a comment for documentation, and ending with a carriage return and line feed. 1666: 1608: 269:
definition in RFC5234 is controversial because at least one whitespace character is needed to form a delimiter between two fields.
272:
Definitions are left-aligned. When multiple lines are required (for readability), continuation lines are indented by whitespace.
1651: 232:
will match “abc”, “Abc”, “aBc”, “abC”, “ABc”, “AbC”, “aBC”, and “ABC”. RFC 7405 added a syntax for case-sensitive strings:
1601: 1564: 1661: 1514: 1172:
The (U.S.) postal address example given in the augmented Backus–Naur form (ABNF) page may be specified as follows:
1697: 39:(BNF), but consisting of its own syntax and derivation rules. The motive principle for ABNF is to describe a 1646: 107: 44: 1702: 1676: 372: 1641: 228:). These strings are case-insensitive, and the character set used is (US-)ASCII. Therefore, the string 36: 164:
all refer to the same rule. Rule names consist of a letter followed by letters, numbers, and hyphens.
1584: 782: 217:
in hexadecimal. A carriage return followed by a line feed may be specified with concatenation as
908:
The following operators have the given precedence from tightest binding to loosest binding:
139: 92: 76: 68: 54: 20: 758:
gives the minimal number of elements to be included (with the default of 0). The optional
183: 947: 112: 1691: 40: 762:
gives the maximal number of elements to be included (with the default of infinity).
1536: 224:
Literal text is specified through the use of a string enclosed in quotation marks (
32: 205:= hexadecimal), followed by the value, or concatenation of values (indicated by 142: 96: 84: 80: 72: 58: 88: 1624: 942: 1164:
in the RFC spec. They are named here for clarity in the main syntax diagram.
856:
To indicate an optional element, the following constructions are equivalent:
1560: 99:
updates it, adding a syntax for specifying case-sensitive string literals.
1510: 539:
A range of numeric values may be specified through the use of a hyphen (
1593: 265:
is for zero or more whitespace characters with newlines permitted. The
240:. A string can also be explicitly specified as case-insensitive with a 1484: 637:
To match "a b d" or "a c d", the following rule could be constructed:
634:
Elements may be placed in parentheses to group rules in a definition.
1487:
adds a warning in conjunction to the definition of LWSP as follows:
371:
A rule may be defined by a list of alternative rules separated by a
48: 673:
To match “a b” or “c d”, the following rules could be constructed:
1671: 941: 424:
Additional alternatives may be added to a rule through the use of
106: 1656: 62: 1597: 119:
An ABNF specification is a set of derivation rules, written as
305:
To match the string “aba”, the following rules could be used:
53:("STD 68", type case sic), which as of December 2010 is 302:
A rule may be defined by listing a sequence of rule names.
289:) starts a comment that continues to the end of the line. 189:
Numeric characters may be specified as the percent sign
813:
To indicate an explicit number of elements, the form
61:, and it often serves as the definition language for 883: 864: 860: 702: 677: 641: 568: 550: 491: 467: 454: 435: 394: 341: 325: 309: 209:). For example, a carriage return is specified by 954:The core rules are defined in the ABNF standard. 186:are specified by one or more numeric characters. 1537:"Augmented BNF for Syntax Specifications: ABNF" 1489: 977:Upper- and lower-case ASCII letters (A–Z, a–z) 750:To indicate repetition of an element, the form 1609: 8: 43:of a language to be used as a bidirectional 16:Metalanguage based on Backus–Naur Form (BNF) 390:, the following rule could be constructed: 1616: 1602: 1594: 428:between the rule name and the definition. 1535:Crocker, D.; Overell, P. (January 2008). 996:DIGIT / "A" / "B" / "C" / "D" / "E" / "F" 1148:Note that in the core rules diagram the 956: 1502: 1511:"Official Internet Protocol Standards" 7: 1567:from the original on 9 February 2010 1517:from the original on 9 February 2010 1076:Any ASCII character, excluding NUL 999:Hexadecimal digits (0–9, A–F, a-f) 1054:Linear white space (past newline) 14: 148:Rule names are case-insensitive: 837: 828:to get two numeric digits, and 781:for two or three elements, cf. 1065:Visible (printing) characters 832:to get three numeric digits. ( 777:for one or more elements, and 1: 817:is used and is equivalent to 487:is therefore equivalent to 1662:Syntax Definition Formalism 769:for zero or more elements, 1719: 1563:. RFC Editor. 2010-02-19. 1513:. RFC Editor. 2010-02-21. 1131:Internet-standard newline 819:<a>*<a>element 752:<a>*<b>element 261:(linear white space), and 25:augmented Backus–Naur form 1632: 1043:Space and horizontal tab 773:for zero or one element, 65:communication protocols. 1542:. RFC Editor. p. 16 1174: 912:Strings, names formation 836:is defined below under " 415:Incremental alternatives 193:, followed by the base ( 121: 1647:Definite clause grammar 844:in the example below.) 45:communications protocol 1494: 1152:charset is inlined in 951: 754:is used. The optional 116: 1677:Wirth syntax notation 988:Decimal digits (0–9) 945: 110: 50:Internet Standard 68 904:Operator precedence 804:Specific repetition 783:regular expressions 741:Variable repetition 382:To accept the rule 47:. It is defined by 952: 924:Grouping, optional 117: 1685: 1684: 1146: 1145: 1051:*(WSP / CRLF WSP) 974:%x41–5A / %x61–7A 963:Formal definition 848:Optional sequence 564:is equivalent to 1710: 1698:Formal languages 1642:Backus–Naur form 1618: 1611: 1604: 1595: 1588: 1582: 1576: 1575: 1573: 1572: 1557: 1551: 1550: 1548: 1547: 1541: 1532: 1526: 1525: 1523: 1522: 1507: 1475: 1472: 1469: 1466: 1463: 1460: 1457: 1454: 1451: 1448: 1445: 1442: 1439: 1436: 1433: 1430: 1427: 1424: 1421: 1418: 1415: 1412: 1409: 1406: 1403: 1400: 1397: 1394: 1391: 1388: 1385: 1382: 1379: 1376: 1373: 1370: 1367: 1364: 1361: 1358: 1355: 1352: 1349: 1346: 1343: 1340: 1337: 1334: 1331: 1328: 1325: 1322: 1319: 1316: 1313: 1310: 1307: 1304: 1301: 1298: 1295: 1292: 1289: 1286: 1283: 1280: 1277: 1274: 1271: 1268: 1265: 1262: 1259: 1256: 1253: 1250: 1247: 1244: 1241: 1238: 1235: 1232: 1229: 1226: 1223: 1220: 1217: 1214: 1211: 1208: 1205: 1202: 1199: 1196: 1193: 1190: 1187: 1184: 1181: 1178: 1109:Carriage return 957: 899: 898: 895: 892: 889: 886: 880: 879: 876: 873: 870: 867: 861: 853: 835: 831: 827: 820: 816: 815:<a>element 810: 799: 795: 791: 787: 780: 776: 772: 768: 761: 757: 753: 747: 736: 735: 732: 729: 726: 723: 720: 717: 714: 711: 708: 705: 699: 698: 695: 692: 689: 686: 683: 680: 669: 668: 665: 662: 659: 656: 653: 650: 647: 644: 631: 620: 619: 616: 613: 610: 607: 604: 601: 598: 595: 592: 589: 586: 583: 580: 577: 574: 571: 560: 559: 556: 553: 542: 536: 525: 524: 521: 518: 515: 512: 509: 506: 503: 500: 497: 494: 483: 482: 479: 476: 473: 470: 464: 463: 460: 457: 451: 450: 447: 444: 441: 438: 427: 421: 410: 409: 406: 403: 400: 397: 378: 368: 357: 356: 353: 350: 347: 344: 338: 337: 334: 331: 328: 322: 321: 318: 315: 312: 299: 288: 282: 268: 264: 260: 243: 239: 235: 231: 227: 220: 216: 212: 208: 204: 200: 196: 192: 174: 170: 167:Angle brackets ( 163: 162:<rUlENamE> 159: 158:<RULENAME> 155: 154:<Rulename> 151: 150:<rulename> 140:case-insensitive 138:where rule is a 134: 131: 128: 125: 37:Backus–Naur form 21:computer science 1718: 1717: 1713: 1712: 1711: 1709: 1708: 1707: 1688: 1687: 1686: 1681: 1628: 1622: 1592: 1591: 1585:RFC Errata 3096 1583: 1579: 1570: 1568: 1559: 1558: 1554: 1545: 1543: 1539: 1534: 1533: 1529: 1520: 1518: 1509: 1508: 1504: 1499: 1482: 1477: 1476: 1473: 1470: 1467: 1464: 1461: 1458: 1455: 1452: 1449: 1446: 1443: 1440: 1437: 1434: 1431: 1428: 1425: 1422: 1419: 1416: 1413: 1410: 1407: 1404: 1401: 1398: 1395: 1392: 1389: 1386: 1383: 1380: 1377: 1374: 1371: 1368: 1365: 1362: 1359: 1356: 1353: 1350: 1347: 1344: 1341: 1338: 1335: 1332: 1329: 1326: 1323: 1320: 1317: 1314: 1311: 1308: 1305: 1303:"Sr." 1302: 1299: 1297:"Jr." 1296: 1293: 1290: 1287: 1284: 1281: 1278: 1275: 1272: 1269: 1266: 1263: 1260: 1257: 1254: 1251: 1248: 1245: 1242: 1239: 1236: 1233: 1230: 1227: 1224: 1221: 1218: 1215: 1212: 1209: 1206: 1203: 1200: 1197: 1194: 1191: 1188: 1185: 1182: 1179: 1176: 1170: 1087:8 bits of data 1032:Horizontal tab 940: 906: 896: 893: 890: 887: 884: 877: 874: 871: 868: 865: 852: 850: 833: 829: 825: 818: 814: 808: 806: 797: 793: 789: 785: 778: 774: 770: 766: 759: 755: 751: 745: 743: 733: 730: 727: 724: 721: 718: 715: 712: 709: 706: 703: 696: 693: 690: 687: 684: 681: 678: 666: 663: 660: 657: 654: 651: 648: 645: 642: 629: 627: 617: 614: 611: 608: 605: 602: 599: 596: 593: 590: 587: 584: 581: 578: 575: 572: 569: 557: 554: 551: 540: 534: 532: 522: 519: 516: 513: 510: 507: 504: 501: 498: 495: 492: 480: 477: 474: 471: 468: 461: 458: 455: 448: 445: 442: 439: 436: 425: 419: 417: 407: 404: 401: 398: 395: 376: 366: 364: 354: 351: 348: 345: 342: 335: 332: 329: 326: 319: 316: 313: 310: 297: 295: 286: 280: 278: 266: 262: 258: 255: 250: 241: 237: 233: 229: 225: 218: 214: 210: 206: 202: 201:= decimal, and 198: 194: 190: 181: 179:Terminal values 172: 168: 161: 157: 153: 149: 136: 135: 133:; comment CR LF 132: 129: 126: 123: 105: 17: 12: 11: 5: 1716: 1714: 1706: 1705: 1700: 1690: 1689: 1683: 1682: 1680: 1679: 1674: 1669: 1664: 1659: 1654: 1649: 1644: 1639: 1633: 1630: 1629: 1623: 1621: 1620: 1613: 1606: 1598: 1590: 1589: 1577: 1552: 1527: 1501: 1500: 1498: 1495: 1481: 1478: 1177:postal-address 1175: 1169: 1166: 1160:is inlined in 1144: 1143: 1140: 1137: 1133: 1132: 1129: 1126: 1122: 1121: 1118: 1115: 1111: 1110: 1107: 1104: 1100: 1099: 1096: 1095:%x00–1F / %x7F 1093: 1089: 1088: 1085: 1082: 1078: 1077: 1074: 1071: 1067: 1066: 1063: 1060: 1056: 1055: 1052: 1049: 1045: 1044: 1041: 1038: 1034: 1033: 1030: 1027: 1023: 1022: 1019: 1016: 1012: 1011: 1008: 1005: 1001: 1000: 997: 994: 990: 989: 986: 983: 979: 978: 975: 972: 968: 967: 964: 961: 948:syntax diagram 939: 936: 932: 931: 928: 925: 922: 919: 916: 913: 905: 902: 901: 900: 881: 862: 849: 846: 805: 802: 742: 739: 738: 737: 700: 671: 670: 626: 625:Sequence group 623: 622: 621: 562: 561: 531: 528: 527: 526: 485: 484: 465: 452: 420:Rule1 =/ Rule2 416: 413: 412: 411: 363: 360: 359: 358: 339: 323: 294: 291: 277: 274: 254: 251: 249: 246: 213:in decimal or 180: 177: 122: 113:syntax diagram 104: 101: 15: 13: 10: 9: 6: 4: 3: 2: 1715: 1704: 1703:Metalanguages 1701: 1699: 1696: 1695: 1693: 1678: 1675: 1673: 1670: 1668: 1665: 1663: 1660: 1658: 1655: 1653: 1650: 1648: 1645: 1643: 1640: 1638: 1635: 1634: 1631: 1626: 1619: 1614: 1612: 1607: 1605: 1600: 1599: 1596: 1586: 1581: 1578: 1566: 1562: 1556: 1553: 1538: 1531: 1528: 1516: 1512: 1506: 1503: 1496: 1493: 1488: 1486: 1479: 1408:"," 1327:"X" 1321:"V" 1315:"I" 1249:"." 1231:personal-part 1225:personal-part 1204:personal-part 1173: 1167: 1165: 1163: 1159: 1155: 1151: 1142:Binary digit 1141: 1138: 1135: 1134: 1130: 1127: 1124: 1123: 1119: 1116: 1113: 1112: 1108: 1105: 1102: 1101: 1097: 1094: 1091: 1090: 1086: 1083: 1080: 1079: 1075: 1072: 1069: 1068: 1064: 1061: 1058: 1057: 1053: 1050: 1047: 1046: 1042: 1039: 1036: 1035: 1031: 1028: 1025: 1024: 1020: 1017: 1014: 1013: 1010:Double quote 1009: 1006: 1003: 1002: 998: 995: 992: 991: 987: 984: 981: 980: 976: 973: 970: 969: 965: 962: 959: 958: 955: 950:of core rules 949: 944: 937: 935: 929: 927:Concatenation 926: 923: 920: 917: 914: 911: 910: 909: 903: 882: 863: 859: 858: 857: 854: 847: 845: 843: 839: 822: 811: 803: 801: 784: 763: 748: 740: 701: 676: 675: 674: 640: 639: 638: 635: 632: 630:(Rule1 Rule2) 624: 618:"7" 612:"6" 606:"5" 600:"4" 594:"3" 588:"2" 582:"1" 576:"0" 567: 566: 565: 549: 548: 547: 544: 537: 529: 490: 489: 488: 466: 453: 434: 433: 432: 429: 422: 414: 393: 392: 391: 389: 385: 380: 374: 369: 367:Rule1 / Rule2 361: 340: 324: 308: 307: 306: 303: 300: 293:Concatenation 292: 290: 285:A semicolon ( 283: 275: 273: 270: 252: 247: 245: 222: 187: 185: 178: 176: 165: 146: 144: 141: 120: 115:of ABNF rules 114: 109: 102: 100: 98: 94: 90: 86: 82: 78: 74: 70: 66: 64: 60: 56: 52: 51: 46: 42: 41:formal system 38: 34: 30: 26: 22: 1636: 1580: 1569:. Retrieved 1555: 1544:. Retrieved 1540:(plain text) 1530: 1519:. Retrieved 1505: 1490: 1483: 1171: 1161: 1157: 1153: 1149: 1147: 953: 933: 907: 855: 851: 841: 840:". Also see 823: 812: 807: 764: 749: 744: 672: 636: 633: 628: 563: 545: 538: 533: 486: 430: 423: 418: 387: 386:or the rule 383: 381: 370: 365: 304: 301: 296: 284: 279: 271: 256: 223: 188: 182: 166: 147: 137: 118: 67: 49: 33:metalanguage 28: 24: 18: 1561:"RFC Index" 1387:street-name 1345:street-name 930:Alternative 918:Value range 530:Value range 362:Alternative 298:Rule1 Rule2 253:White space 143:nonterminal 75:supersedes 1692:Categories 1625:Metasyntax 1571:2010-02-21 1546:2010-02-21 1521:2010-02-21 1497:References 1255:first-name 1237:first-name 938:Core rules 921:Repetition 838:Core rules 779:2*3element 238:%d97.66.99 197:= binary, 130:definition 1627:notations 1492:contexts. 1429:town-name 1405:town-name 1363:house-num 1339:house-num 1276:last-name 1219:name-part 1213:last-name 1192:name-part 1183:name-part 1162:prose-val 1139:"0" / "1" 1120:Linefeed 1098:Controls 1040:SP / HTAB 775:1*element 771:*1element 760:<b> 756:<a> 546:The rule 431:The rule 281:; comment 248:Operators 184:Terminals 35:based on 1565:Archived 1515:Archived 1485:RFC 5234 1480:Pitfalls 1465:zip-code 1423:zip-code 1399:zip-part 1189:zip-part 1154:char-val 966:Meaning 842:zip-code 767:*element 244:prefix. 103:Overview 1267:initial 1246:initial 1168:Example 1084:%x00–FF 1073:%x01–7F 1062:%x21–7E 985:%x30–39 915:Comment 746:n*nRule 558:%x30-37 535:%c##-## 493:ruleset 469:ruleset 456:ruleset 437:ruleset 373:solidus 276:Comment 234:%s"aBc" 219:%d13.10 31:) is a 1333:street 1288:suffix 1186:street 1021:Space 1004:DQUOTE 993:HEXDIG 830:3DIGIT 826:2DIGIT 798:e{2,3} 343:mumble 160:, and 95:  79:  71:  57:  1672:OMeta 1474:DIGIT 1462:ALPHA 1453:state 1441:ALPHA 1414:state 1396:VCHAR 1381:ALPHA 1375:DIGIT 1360:DIGIT 1285:ALPHA 1273:ALPHA 1264:ALPHA 1158:CHAR3 1150:CHAR2 1128:CR LF 1081:OCTET 1059:VCHAR 982:DIGIT 971:ALPHA 946:ABNF 894:snafu 891:fubar 875:snafu 872:fubar 834:DIGIT 809:nRule 704:group 679:group 643:group 570:OCTAL 552:OCTAL 396:fubar 230:"abc" 111:ABNF 1667:TBNF 1657:JSGF 1652:EBNF 1637:ABNF 1426:CRLF 1348:CRLF 1228:CRLF 1216:CRLF 1156:and 1125:CRLF 1117:%x0A 1106:%x0D 1070:CHAR 1048:LWSP 1029:%x09 1026:HTAB 1018:%x20 1007:%x22 960:Rule 824:Use 796:and 765:Use 523:alt5 517:alt4 511:alt3 505:alt2 499:alt1 481:alt5 475:alt4 462:alt3 449:alt2 443:alt1 333:%x62 317:%x61 267:LWSP 263:LWSP 215:%x0D 211:%d13 173:> 169:< 124:rule 97:7405 87:and 85:2234 81:4234 73:5234 63:IETF 59:5234 29:ABNF 1417:1*2 1369:1*8 1357:1*4 1351:apt 1136:BIT 1092:CTL 1037:WSP 885:0*1 543:). 408:bar 388:bar 379:). 352:bar 336:; b 327:bar 320:; a 259:WSP 93:RFC 89:733 77:RFC 69:RFC 55:RFC 19:In 1694:: 1447:SP 1435:1* 1420:SP 1411:SP 1393:1* 1342:SP 1330:)) 1309:1* 1222:=/ 1207:SP 1114:LF 1103:CR 1015:SP 866:*1 821:. 800:. 794:e+ 792:, 790:e? 788:, 786:e* 472:=/ 459:=/ 426:=/ 402:fu 384:fu 355:fu 349:fu 311:fu 242:%i 221:. 171:, 156:, 152:, 91:. 83:, 23:, 1617:e 1610:t 1603:v 1587:. 1574:. 1549:. 1524:. 1471:5 1468:= 1459:2 1456:= 1450:) 1444:/ 1438:( 1432:= 1402:= 1390:= 1384:) 1378:/ 1372:( 1366:= 1354:= 1336:= 1324:/ 1318:/ 1312:( 1306:/ 1300:/ 1294:( 1291:= 1282:* 1279:= 1270:= 1261:* 1258:= 1252:) 1243:( 1240:/ 1234:= 1210:) 1201:( 1198:* 1195:= 1180:= 897:) 888:( 878:) 869:( 734:) 731:d 728:c 725:( 722:/ 719:) 716:b 713:a 710:( 707:= 697:d 694:c 691:/ 688:b 685:a 682:= 667:d 664:) 661:c 658:/ 655:b 652:( 649:a 646:= 615:/ 609:/ 603:/ 597:/ 591:/ 585:/ 579:/ 573:= 555:= 541:- 520:/ 514:/ 508:/ 502:/ 496:= 478:/ 446:/ 440:= 405:/ 399:= 377:/ 375:( 346:= 330:= 314:= 287:; 226:" 207:. 203:x 199:d 195:b 191:% 127:= 27:(

Index

computer science
metalanguage
Backus–Naur form
formal system
communications protocol
Internet Standard 68
RFC
5234
IETF
RFC
5234
RFC
4234
2234
733
RFC
7405
ABNF syntax diagram of ABNF rules
syntax diagram
case-insensitive
nonterminal
Terminals
solidus
regular expressions
Core rules
ABNF syntax diagram of core rules
syntax diagram
RFC 5234
"Official Internet Protocol Standards"
Archived

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.