On Thu, 26 Sep 2002, John Williams wrote: : I'm trying to write a revised operator precedence table for perl6, : similar to the one in perlop.pod. : : This is what I have come up with based on Apocalypse 3 and Exegesis 3. : Does anyone have comments? I'm not sure if the precedence : for : (adverb) or 'is' and 'but' are quite right.
Me either. : perl6 operator precedence : : left terms and list operators (leftward) [] {} () quotes : left . and unary . Unary . can't be left associative. Perhaps unary . is nonassoc like ++. : nonassoc ++ -- : left is but Should probably be down about where .. is, maybe same as. : right ** : right ! \ and unary ~ + - * _ Probably unary ? goes here too. : left =~ !~ Probably should be the same as all the other comparison ops. : left * / % x And & maybe. : left + - _ And | maybe. : left << >> Can be argued these are really just multiplicative. Or even exponential. : right named unary operators, -X : left < > <= >= lt gt le ge == != <=> eq ne cmp : left & : left | ~ Not sure what to do with ~ if we move & and |. Probably just follows |. : left && : left || ~~ // : nonassoc .. ... Maybe "but" here. Maybe "is" too, though compile-time declarations don't necessarily have the same syntactic constraints as ordinary expressions. : right ??:: : right = := **= += -= _= *= /= %= x= &= |= ~= : <<= >>= &&= ||= ~~= //= : left , => => is no longer a comma. I think it has to be tighter than , now, or we can't say a => "a", b => "b" Perhaps it goes in as another nonassoc .. operator. : left ; : left : While semicolon is definitely looser than comma, it's not clear where colon should go yet. : nonassoc list operators (rightward) : right not I've also considered unifying C<not> with the list operators, which are actually right associative, or you couldn't say print sort 1,2,3; On the other hand, it would be strange for C<not> to give its right side a list context. : left and : left or xor err Those are fine. :-) Larry