At one level, the Augmented BNF (ABNF) notation is simply a convenient textual approach for describing a grammar. In turn, a grammar is a description of the allowable linguistic constructs permitted in a particular language or any other syntactic construction. Examples of common and emerging grammars written using ABNF notation include:
- URLs for web pages on the World Wide Web
- OASIS/ISO OData Open Data Specification
- Decentralized Identifiers (DIDs)
More importantly, a grammar that conforms to the ABNF specification (RFC4234-4) is also an executable program. That is, a grammar is the source code for program (written in the ABNF notation (aka ABNF programming language)) that recognizes and, optionally, processes a piece of text (string of tokens) that conforms to the grammar’s specification (expressed using ABNF notation).
Summary: The “ABNF Principles”
The “ABNF Principles” include:
- “ABNF” is a specification for a notation for describing a grammar.
- “ABNF notation” is the notation described in the ABNF specification for describing a grammar.
- A grammar is a description of the allowable linguistic constructs permitted in a particular language or any other syntactic construction.
- RFC4234-4 is a formal specification for ABNF notation.
- A grammar expressed using ABNF notation is intended to be executable.
- A grammar expressed using ABNF notation is the source code for a program that can be read, interpreted, compiled, and/or executed by a human, interpreter, compiler, or virtual machine, respectively, in a way that conforms to the ABNF formal specification.
Best Practices for Developing Grammars Written using ABNF Notation
- As in any software development project, it is of primary importance to understand the scope of the functionality, inputs, and outputs of the intended software (aka requirements).
- One of the best, commonly accepted ways to understand of the scope of the intended software to be developed is to work through the following series of artifacts:
- User stories, which in turn are decomposed into
- Use cases, and
- Requirements, and
- Use automation together with the use cases to create an automatable testing framework starting early in the project – automatically validating the the grammar against the test cases (derived from the use cases) on an ongoing basis.
NOTE: These artifacts can be developed iteratively using an agile or other type of development framework. It doesn’t require a waterfall approach.