When BNF evolved, many implementations were improved by their authors.

Suppose we need a grammar to parse these algebra expressions:

1. (x + y) * z 2. x + (y * z) 3. x + y * z

`x`

,`y`

, and`z`

is the complete alphabet of variable-names`+`

and`*`

are the operators`(`

brackets`)`

may be used to group sub-expressions

On this page, all of the following dialects of BNF have the same meaning.

Dialect 6 conforms to the International Standard
ISO-14977 Syntactic Meta-Language

- Terminals are written naturally
- Non-terminals are enclosed in <angle brackets>
- The "definition" symbol is
`::=`

- It has no statement terminator (not even end-of-line) so each rule terminates when the next one begins

<expr> ::= <term> | <expr> + <term> <term> ::= <element> | <term> * <element> <element> ::= x | y | z | ( <expr> )

- Terminals are written naturally
- Non-terminals are enclosed in <angle brackets>
- The "definition" symbol is
`->`

- It has no statement terminator

<expr> -> <term> | <expr> + <term> <term> -> <element> | <term> * <element> <element> -> x | y | z | ( <expr> )

- Terminals are written in
**bold font** - Non-terminals are written naturally
- The "definition" symbol is
`::=`

- Each rule terminates at the end of its line

expr ::= term | expr+term term ::= element | term*element element ::=x|y|z|(expr)

- Terminals are written in
**bold font** - Non-terminals are written naturally
- The "definition" symbol is
`::=`

- There is no
`|`

choice symbol, so a list of single definitions is written like a list - Each statement terminates at the end of its line, and the rule terminates when the next rule begins

expr ::= term ::= expr+term term ::= element ::= term*element element ::=x::=y::=z::=(expr)

- Terminals are enclosed in
**"**quotes**"** - Non-terminals are written naturally
- The "definition" symbol is
`=`

- Each rule terminates with a semi-colon
**;**

expr = term | expr "+" term; term = element | term "*" element; element = "x" | "y" | "z" | "(" expr ")";