Remix.run Logo
sebtron 10 hours ago

This seems to be the best guess so far. But then I am wondering, how is

    a (*) b + c
Parsed then? The precedence of '* is bumped down, but does that mean it has now strictly lower precedence of '+', or the same? In the first case the operation is parsed as

    a * (b + c)
In the second case, the "left to right" rule takes over and we get

    (a * b) + c
And what happens when there are more than 2 priority groups Taking C has an example, we have that '' has higher precedence than '+' which has higher precedence than '<<' [1]. So

    a + b * c << d
Means

    (a + (b * c)) << d
Now I could use the "decrease precedence" operator you proposed (possibly proposed by the author?) and write

    a + b (*) c << d
Which then bumps down the precedence of '
' to... One level lower? Which means the same level of '+', or a level lower, i.e. a new precedence level between '+' and '<<'? Or maybe this operator should end up at the bottom of the precedence rank, i.e. lower than ','?

The more I think about this, the less sense it makes...

[1] https://en.cppreference.com/w/c/language/operator_precedence...