Desugar parsing for <| and |> directly into function calls
jfecher opened this issue · 0 comments
jfecher commented
The tokens for these operators already exist: Token::ApplyLeft
and Token::ApplyRight
respectively.
|>
should be left-associative with a precedence two levels under +
<|
should be right-associative with a precedence one level under +
Support for these can be added in the parser such that
a |> foo b c |> bar d e
parses as bar (foo a b c) d e
and
bar d e <| foo b c <| a
also parses as bar (foo a b c) d e
.
It would be nice if the parser desugared the operator directly into the above function calls so no further handling would need to be done in later passes.