TropicSapling/triforce

Arithmetic is not working properly

Opened this issue · 1 comments

For example:

(1 + 2) * 3

will compile into:

1 + 2 * 3

instead of the correct:

(1 + 2) * 3

This can be solved easily by re-adding parentheses, but then other things would not compile correctly instead, like this:

1 + 2 - 3 - 4

compiling into this:

1 + (2 - (3 - 4))

instead of the correct:

((1 + 2) - 3) - 4)

So somehow I must find a solution working in all cases where none of these issues occur.

Left-associative operators resolve this. Previously, that was hard to implement because of every other function being right-associative though. Right now there is no defined behaviour. If I decide to make everything left-associative, this issue will be resolved.