Given the syntax a ++ b, it's not a simple ambiguity between two
operators.
There is an ambiguity about where we perceive the invisible catenation
operator to be, and based on that interpretation, ++ changes between two
different categories: prefix and postfix.
Interpretation 1: a <cat> ++ b --> ++ b prefix increment.
Interpretation 2: a ++ <cat> b --> a ++ postfix increment.
Where <cat> is an invisible operator not represented by a token,
but emerges via grammar rules which deal with the juxtaposition
of expressions directly.
This is not something where the disambiguating resolution can be
understood in terms of the simplifying concept of operator precedence,
since between the two interpretations, the ++ token jumps onto different
operands and becomes a different operator, and since the fictional <cat>
operator cannot be assigned a precedence at all.
The simplest treatment in a LALR(1) parser is that whenever the
parser has scanned an expression (it has a complete expression in
its stack that could be reduced) and the next token is ++, it should
just "shift" that ++ and keep scanning, rather than "reduce" and
try to deal with catenation.
The latter arrangement could be made, but I think it would complicate
the grammar quite severely. Basically the postfix operatorsl like ++
would have to be moved to a different expression "level" above
catenation or something like that.
I think Janis' left-to-right parsing remark reflects this intuition
that the natural parse is to shift these postfix operators (and any
other token), so that catenation is recognized only when some token
appears that cannot continue the current expression and *can* begin a
new expression.
--
TXR Programming Lanuage:
http://nongnu.org/txr
Music DIY Mailing List:
http://www.kylheku.com/diy
ADA MP-1 Mailing List:
http://www.kylheku.com/mp1