Give operators precedence using the shunting-yard algorithm
I adopted the C language operator precedence, with all the controversy
it may cause with regards to the bitshift operators. Please note that
I even kept the precedence of exclusive OR over inclusive OR (for
example Perl treats them both with same precedence).
Note that two pseudo-operators are added:
- ABO_LPAREN: used only during parsing
- ABO_RPAREN: never even exists as an atom; it is used to stop stack
reduction at the nearest left parenthesis
I could use ABO_OR instead of ABO_RPAREN, but it would make the code
hard to maintain if I want to add another operator with lower precedence
than OR (e.g. the ?: operator).
I'm using incomplete atom_bin structures for the operator stack. This
means that I have to check whether atom1 and atom2 exists when I free
the atom.