Let us take our simple language
       L = { a, a+a, a+a+a, a+a+a+a, ... }
and add balanced parentheses.

-----------------------------------------------------------------------------


Here is an ambiguous BNF grammar for this language.


BNF:    expr -> expr + expr | ( expr ) | a

-----------------------------------------------------------------------------


Here is an unambiguous, right associative, BNF grammar
(and an EBNF grammar derived from it).


BNF:    expr -> a + expr | ( expr ) + expr | ( expr ) | a

EBNF:   expr -> a [ + expr ]  |  ( expr ) [ + expr ]


Here are simplified grammars.

BNF:   expr -> term + expr | term
       term -> a | ( expr )

EBNF:  expr -> term [ + expr ]
       term -> a | ( expr )

EBNF:  expr -> term [ + term ]*
       term -> a | ( expr )

Notice how we can use two non-terminals in order to simplify this grammar,
but they are not required for disambiguating the grammar.

-----------------------------------------------------------------------------


Here is an unambiguous, left associative, BNF grammar
(and an EBNF grammar derived from it).


BNF:    expr ->  expr + a | expr + ( expr ) | ( expr ) | a

EBNF:   expr -> [ expr + ] a  |  [ expr + ] ( expr )


Here are simplified grammars.

BNF:   expr -> expr + term | term
       term -> a | ( expr )

EBNF:  expr -> [ expr + ] term
       term -> a | ( expr )

EBNF:  expr -> [ term + ]* term
       term -> a | ( expr )

-----------------------------------------------------------------------------


Since we now using parentheses in our language, we can specify the following
interesting property. We can force + to be a non-associative operator. This
means that the string "a+a+a" would not be allowed in the language. Instead,
parentheses would have to be used when there is more than one + operator.
(For example, in the programming language Maple, the exponentiation
operator, ^, is non-associative and 2^3^4 has no meaning.)


BNF:  expr -> a + a | a + ( expr ) | ( expr ) + a | ( expr ) + ( expr ) | ( expr ) | a


Here is a simplified grammar.

BNF:  expr -> term + term | term
      term -> a | ( expr )

-----------------------------------------------------------------------------