My results were probably caused by a bug of the parser generator
rather then in a wrong grammar. Instead of assigning to '$$' I tried
using a custom stack for building the expressions and then the result
tree was correct.

> [The usual problem is that you're not allocating space properly for> the tree nodes you create. And please spell it "grammar". -John]