Go over Operator Precedence
rocky opened this issue · comments
Description
Go over Operator precedence. Possibly this is an activity in mathics scanner where we create new operator tables which include: Precedence[]
, and the actual precedence, taking into account affix and arity of the operator. See also https://wltools.github.io/LanguageSpec/Specification/Syntax/OperatorTableHTML/
How to Reproduce
In WMA, the right value for the precedence would be exactly the same as Times (400):
In[1]:= Times[b, PrecedenceForm[3 A ,400]]
Out[1]= b (3 A)
In[2]:= Times[b, PrecedenceForm[3 A ,401]]
Out[2]= b 3 A
In Mathics, this does not works in the same way:
In[1]:= Times[b, PrecedenceForm[3 A ,400]]
Out[1]= b (3 A)
In[2]:= Times[b, PrecedenceForm[3 A ,401]]
Out[2]= b (3 A)
In[2]:= Times[b, PrecedenceForm[3 A ,399]]
Out[2]= b (3 A)
but
In[1]:= Times[b, PrecedenceForm[A ,400]]
Out[1]= b A
In[2]:= Times[b, PrecedenceForm[3 A ,401]]
Out[2]= b A
In[2]:= Times[b, PrecedenceForm[3 A ,399]]
Out[2]= b (A)
Additional context
The above example is extracted from #809 (comment) and #810