octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator o


From: Michael Leitner
Subject: [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator
Date: Fri, 21 Sep 2018 04:07:05 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux i686; rv:47.0) Gecko/20100101 Firefox/47.0

Follow-up Comment #4, bug #54698 (project octave):

Isn't this unnecessarily complex? Is an explicit rule about operator
collapsing actually needed? To my view, the only point where the documentation
could perhaps be misunderstood is the fact that unary operators always group
from inside to outside, and that unary operators always take precedence before
binary operators. The second statement follows from the given precedence
table, but the first is not explicitly stated. 

If we have these rules, then an expression is parsed by first deciding whether
a given '+' is unary or binary and so on, then applying all the unary
operators onto their objects from inside to outside (where you have only to
decide whether the prefix or the postfix has higher precedence), and finally
the binary operators according to their precedence and grouping rules. 

Two points that I noticed: it says that postfix increment and decrement group
right to left. But is this relevant? I do not see a possibility how this could
arise in a valid expression, e.g. "a=0;a++++" is not accepted. And anyway it
would be nonsense, because grouping from right to left would mean that this
should be understood as "a(++(++))". 

And the second point: I would have assumed that "+++a" would be valid, and
would be just the converse of "-++a". But while the second is parsed
correctly, for the first expression the parsing seems to result in the
increment of "+a", which is not an lvalue. But as it seems that the only
documentation of Octave's syntax is the implementation, the parser obviously
works correctly by definition.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?54698>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]