This is an *ambiguous* grammar for boolean logic formulas:

B --> 
 |       true
 |       false
 |       var        // strings
 |       B | B      // or
 |       B & B      // and
 |       B -> B     // implication
 |       ~B         // negation
 |       ( B )      // grouping


Note: in the 'or' case above, the first '|' is part of the metasyntax
that defines the rules of the grammar.  The second '|' is a
nonterminal symbol of the grammar itself.

Let's disambiguate by making 
  | and &     left associative
  ->          right associative

Giving each operator a precedence according to the usual conventions
of math:

  ~ binds "tightest" of all  (i.e. with highest precedence )
  & binds tigher than | which binds tighter than ->

Using parentheses creates a grouping with the highest precedence

