You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
flowc and the Python parser disagree on shift and bitwise operator precedence #995
flowc (flowc_parse_binop_prec in compiler/src/parser.flow): || 1, && 2, &|^<<>> all 3, ==!= 4, comparisons 5, +- 6, */% 7.
Differences:
Shifts. Python binds <</>> tighter than comparison and equality; flowc binds them looser. a << 2 < b is (a << 2) < b in Python and a << (2 < b) in flowc.
|, ^, & share one level in flowc and associate left, so a | b ^ c is (a | b) ^ c in flowc and a | (b ^ c) in Python.
Both parse, so parse coverage cannot see this. It changes the meaning of the C that Stage-A emits. Suggested fix: give flowc the Python levels (| 3, ^ 4, & 5, equality 6, comparison 7, shifts 8, additive 9, multiplicative 10) and check compiler/src for expressions whose meaning would change before regenerating the bootstrap C.
Activity
fix(stage-a): match Python operator precedence; keep sort modifier wo…
fix(stage-a): match Python operator precedence; keep sort modifier wo…