Who is bnf
Content on WhatAnswers is provided "as is" for informational purposes. While we strive for accuracy, we make no guarantees. Content is AI-assisted and should not be used as professional advice.
Last updated: April 8, 2026
Key Facts
- Invented by John Backus and Peter Naur in the late 1950s
- First published in 1959 in the ALGOL 60 report
- Used to describe syntax of over 95% of modern programming languages
- Standardized by ISO/IEC 14977 in 1996
- Extended variants include EBNF (Extended BNF) and ABNF (Augmented BNF)
Overview
Backus-Naur Form (BNF) is a formal notation technique developed in the late 1950s to precisely describe the syntax of programming languages. It was invented by John Backus and Peter Naur during the development of the ALGOL programming language. The notation was first published in 1959 as part of the ALGOL 60 report, which revolutionized how programming languages were specified.
The creation of BNF addressed a critical need in computer science: providing an unambiguous way to define programming language syntax. Before BNF, language specifications were often described in natural language, leading to inconsistencies and implementation errors. BNF provided a mathematical foundation for syntax description that could be used by both humans and computers. This innovation coincided with the rise of compiler theory and formal language theory in the 1960s.
BNF's historical significance extends beyond its technical contributions. It represents one of the earliest successful applications of formal methods in computer science. The notation helped establish computer science as a rigorous discipline with mathematical foundations. Today, BNF remains essential for language designers, compiler writers, and software engineers working with language processing tools.
How It Works
BNF uses a simple but powerful notation system to define language syntax through production rules.
- Production Rules: BNF consists of production rules that define how symbols can be combined. Each rule has the form nonterminal ::= expression, where the nonterminal on the left can be replaced by the expression on the right. For example, a simple arithmetic expression might be defined as expression ::= number | expression operator expression. These rules create a hierarchical structure that defines valid language constructs.
- Terminals and Nonterminals: BNF distinguishes between terminals (actual symbols that appear in the language) and nonterminals (abstractions that represent language constructs). Terminals are typically written in quotes or bold, while nonterminals are written in angle brackets or italics. For instance, in <digit> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9", the digit is a nonterminal that expands to terminal symbols 0-9.
- Recursive Definitions: BNF allows recursive definitions where a nonterminal can be defined in terms of itself. This enables the description of arbitrarily complex structures. For example, <list> ::= <element> | <list> , <element> defines lists that can contain any number of elements. Recursion is essential for describing programming language features like nested expressions and statement blocks.
- Choice and Sequence: BNF provides two fundamental operations: choice (represented by |) and sequence (represented by concatenation). Choice allows alternatives, while sequence specifies ordering. These operations, combined with recursion, give BNF its expressive power. A typical BNF grammar contains dozens to hundreds of production rules defining all language constructs.
The notation's simplicity belies its power. BNF grammars can be processed algorithmically by parser generators like YACC and ANTLR, which automatically create parsers from BNF specifications. This automation has dramatically reduced the effort required to implement programming languages and has enabled the development of domain-specific languages for various applications.
Types / Categories / Comparisons
BNF has evolved into several variants with different capabilities and applications.
| Feature | Standard BNF | EBNF (Extended BNF) | ABNF (Augmented BNF) |
|---|---|---|---|
| Notation Complexity | Basic notation with ::=, |, and angle brackets | Adds {}, [], ?, +, * for repetition and optional elements | Adds numerical repetition, prose values, and case sensitivity |
| Primary Use Cases | Academic specifications, simple language definitions | Programming language standards (ISO standards) | Internet protocols (RFC specifications) |
| Readability | Less readable for complex constructs | More readable with shorthand notations | Balanced readability for protocol specifications |
| Standardization | De facto standard since 1959 | ISO/IEC 14977:1996 standard | RFC 5234 and RFC 7405 standards |
| Example Construct | <list> ::= <element> | <list> , <element> | list ::= element { "," element } | list = 1*element *("," element) |
Standard BNF provides the foundational notation but can become verbose for complex languages. EBNF, developed in the 1970s, adds syntactic sugar that makes grammars more concise and readable. ABNF, standardized for internet protocols, includes features specifically useful for communication protocols, such as numerical repetition operators and case-sensitive string literals. Each variant serves different communities: BNF in academia, EBNF in programming language design, and ABNF in networking standards.
Real-World Applications / Examples
- Programming Language Specifications: Over 95% of modern programming languages use BNF or its variants in their official specifications. The Java Language Specification (JLS) contains approximately 1,200 production rules in EBNF notation. Python's grammar is defined using a modified EBNF with about 150 rules. These specifications ensure that different implementations (like Oracle JDK and OpenJDK for Java) produce compatible compilers that accept the same programs.
- Compiler Construction: Parser generators like YACC (1975), Bison, and ANTLR (1989) take BNF-like grammars as input and automatically generate parser code. ANTLR alone has been used to build parsers for over 200 programming languages and domain-specific languages. These tools have reduced parser implementation time from months to days, enabling rapid language development and experimentation.
- Data Format Definitions: BNF is used to define data formats like JSON, XML, and configuration file syntax. The JSON specification (RFC 8259) uses ABNF to define valid JSON structures. XML's grammar is defined using EBNF in the W3C specifications. These formal definitions ensure interoperability between different parsers and validators, crucial for data exchange in web applications and distributed systems.
Beyond these core applications, BNF appears in unexpected places. Database query languages like SQL use BNF for syntax definitions. Markup languages have BNF grammars. Even natural language processing researchers sometimes use BNF variants to describe syntactic structures. The notation's versatility stems from its mathematical foundation in formal language theory, which applies equally to programming languages, data formats, and other structured notations.
Why It Matters
BNF's impact on computer science cannot be overstated. It provided the first practical method for precisely defining programming language syntax, enabling the compiler revolution of the 1960s and 1970s. Before BNF, each compiler implementation interpreted language specifications differently, leading to incompatible dialects. BNF created a common language for specification that could be understood by both humans and machines. This standardization was crucial for the development of portable software and interoperable systems.
The notation continues to evolve and find new applications. Recent developments include visual BNF editors, integration with integrated development environments (IDEs), and use in educational tools for teaching programming language concepts. BNF's mathematical foundation connects it to broader areas of computer science, including automata theory, computational linguistics, and software verification. As new programming paradigms emerge, BNF adapts to describe them, demonstrating its enduring relevance.
Looking forward, BNF will remain essential for defining the syntax of emerging technologies. Domain-specific languages (DSLs), which have grown from approximately 5% of software projects in 2000 to over 30% today, rely heavily on BNF for their specifications. New language features like pattern matching, async/await syntax, and type system extensions all require precise syntactic definitions. BNF's simplicity, combined with its formal rigor, ensures it will continue to be the notation of choice for language designers for decades to come.
More Who Is in Daily Life
Also in Daily Life
More "Who Is" Questions
Trending on WhatAnswers
Browse by Topic
Browse by Question Type
Sources
- WikipediaCC-BY-SA-4.0
Missing an answer?
Suggest a question and we'll generate an answer for it.