BNF Syntax : BNF Structure and Conventions : BNF Notations

BNF Notations

The | indicates a mutually exclusive choice between symbols in a nonterminal symbol definition. For example:

variable_name | numeric_constant |integer | function_name

The  separates the nonterminal symbol on the left from its definition on the right and can be read as “is defined as...”. For example:

relational_operator  = | < > | < | <= | >=

Square brackets ([]) indicate that the symbols within the brackets are optional. For example:

[directory_name] filename

Curly braces ({}) indicate that the symbols within the braces are optional and can be repeated. For example:

begin {statement} end;