equ directive should support operator precedence in its arithmetic expressions
Problem
The equ directive can contain arithmetic expressions. But apparently, there is no support for operator precedence. So the following equ statement:
helloRowCol equ helloRow + $100*helloCol
is currently interpreted as (helloRow+$100) * helloCol.
The correct expression has to be written as:
helloRowCol equ helloRow + ($100*helloCol)
as done in #82, but this is very easy to forget.
Expectation
- The
equdirective should support basic operator precedence, so that multiplication*and division/has a higher precedence than addition+andsubtraction-`. - If there are other operators supported by the
equ, a reasonable order of precedence would be to follow the same rules as the C language.
As far as I'm aware, this is intentional design for compatibility with TASM.
Interesting. In that case, this is a place where a non-fatal warning message would be useful. In other words, if the current left-to-right operator precedence rule would produce a different result than the MDAS rule that many people would expect.
It would be nice to have a flag to use proper precedence.