kaleidoscope icon indicating copy to clipboard operation
kaleidoscope copied to clipboard

Precedence on `|` operator is problematic

Open yigitozkavci opened this issue 7 years ago • 0 comments

In the kicking-the-tires part, we used:

def binary == 9 (LHS, RHS) =
  !(LHS < RHS | LHS > RHS);

However, precedence of | should be higher than both < and > in order to use it properly without brackets. These two expressions are being evaluated to two different results now:

putchar(30 < 31 | 30 > 31);     # 0.0, wrong
putchar((30 < 31) | (30 > 31)); # 1.0, right

It's fixed by adding binary ">" Ex.AssocLeft just in near binary "<" Ex.AssocLeft in the parser, but don't know if it's the right solution.

yigitozkavci avatar May 14 '17 14:05 yigitozkavci