Augmented Backus Naur Format
Comparing ABNF and EBNF
Backus Naur formats are metalanguages used to describe other languages and structured text. They have a longish history. While formal language description systems date back to Pāṇini’s Sanskrit grammar from 2,500 years ago, modern variants evolved from John Backus’s work in the 1950s.
Panini
Variation history
Demo
Evolution of Notation Systems
BNF and Wirth Syntax Notation (1960s-1970s)
The original Backus-Naur Form (BNF) was developed for defining ALGOL 58’s syntax. Niklaus Wirth later created the Wirth Syntax Notation (WSN), which added important features like repetition using {...}
.
EBNF Development (1977)
EBNF emerged from Wirth’s beautifully short article in ACM. Key developments in Pascal’s documentation:
- 1969: Original BNF notation
- 1971: Introduction of WSN
- 1973-74: Refinements in Pascal reports
- 1977: Formal EBNF proposal
- 1985: EBNF adoption in Pascal (3rd Edition)
Modern Variants
- Go EBNF: Simplified version that leverages Go language conventions
- ISO EBNF: Formal but more complex standard
- ABNF: Standardized through IETF RFCs with precise rules
Syntax Comparison
Feature | BNF | EBNF | ABNF | Notes |
---|---|---|---|---|
Definition | ::= | = | = | Rule declaration |
Alternatives | | | | | | | Choice between options |
Optional | - | […] | […] | Optional elements |
Repetition | - | {…} | n*m | ABNF allows count ranges |
Grouping | - | (…) | (…) | Combining elements |
Comments | - | (…) | ; | ABNF uses line comments |
Termination | - | ; | ; | End of rule marker |
Modern Considerations
Case Sensitivity
ABNF added case sensitivity support through RFC 7405, making it more precise for modern usage.
Unicode Support
While ABNF officially uses ASCII, there are proposals like Leonard and Kyzivat’s draft to standardize Unicode handling.