Partially rewritten AST compilation:
 - More straightforward approach for handling right-to-left associativity
 - More straightforward approach to handling unary operators
 - Improved handling of brackets

This fixes #5784, #5795, #5797, #5799, #5810 and a bunch of other problems