How to read BNF diagrams

In BNF, the syntax is written out in a line. Square brackets, [ and ], braces, { and }, and the vertical bar symbol, |, are used to describe the syntax. Collectively, these symbols are known as controls.

Blanks are used to separate the syntax elements from the square brackets, braces and vertical bars. Use your screen reader's "speak next word" (usually Control + RightArrow key) and "speak prior word" (usually Control + LeftArrow key) to move between successive BNF controls and syntax elements.

Characters that you need to include when you are constructing your command (for example, left and right brackets ( and ), and separators such as a comma) are located at the point at which you need to type them in. For example, a left bracket can be read out before a list of options. In some programming languages, such as C, C++, and Java, square brackets, braces and the vertical bar symbol are used within the language. For ease of identification, where the square bracket, brace or vertical bar symbol appears in the syntax diagram as a part of the programming language, it is preceded by the escape character, which is a \ (backslash). For example, if you hear \{, you know that you should actually type in the { at that point when you are constructing your command, and that the { is not a part of the structure of the syntax diagram.

The BNF syntax works as follows:



© IBM Corporation 1994, 2002. All Rights Reserved