Your first guess is OK. You may find easyer to understan it if you start with the Reversed Polish Notation, which is a little more intuitive for programmers.

en.wikipedia.org/wiki/Reverse_Polish_notation

There is a good example:

The infix expression "5 + ((1 + 2) * 4) â 3" can be written down like this
in RPN:

```
5 1 2 + 4 * + 3 -
```

The reversed notation is exactly the same, but enables you to resolve without going back and forth.

The infix expression requires you to compute first the inner addition "1 + 2", then multiply by 4, then add 5 and finally add 3, off course you can change some orders and thats one problem.

With reverse polish notation you apply the operators you find to the inmediately preceding operands in the stack, the partial result replace them as a new operand, you follow the same with the next operator, an so on until there's no more operators.
In this case: "5 1 2 + 4 * + 3 -" you find + and apply to 1 and 2, replace with the partial result, now your stack is "5 3 4 * + 3 -", find first operator again, *, and apply to two preceding operands, 4 and 3, now you have this stack "5 12 + 3 -", find the next operator, + , and apply to preceding operands, 5 and 12, replace the result in the stack "17 3 -", again, find the firs operator and apply the preceding operands: "14". Done.

In this example you take always two operands because thats that's what apply to the operators, if you find unary operator (a negation for example) you apply to only one preceding operand. You could find an operator which requires 3 or more operands.

In your example, if you reverse and simplify the expression you get this:

E D C | | B A | &

If you resolv this logical expresion with the same algorithm follow in the previous numeric example, you'll find you get exactly what you want.

Thereafter, you only need to acomodate your mind to the non-reversed notation, which is the same, perhaps a little bit less intuitive.

Hope this helps.

Best regards.

Thanks! I did read that Wikipedia article. When I read 'the result is a syntax lacking parentheses or other brackets that can still be parsed without ambiguity' I figured you were not supposed to use parentheses! Isn't the arity of & and | fixed ?