-
I'm experimenting with the parser, and something is confusing me.
I don't understand why parens are needed in order for the expression to be parsed. In other contexts, the parens aren't needed. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Yes, the rules around parentheses are some of my least favorite rules. Check out https://prql-lang.org/book/reference/syntax/operators.html#parentheses... The reason we can't always loosely bind But this was the best tradeoff we could come up with. (Lots of old issues on this that are required context to make progress here...) |
Beta Was this translation helpful? Give feedback.
Yes, the rules around parentheses are some of my least favorite rules. Check out https://prql-lang.org/book/reference/syntax/operators.html#parentheses...
The reason we can't always loosely bind
=
so thatlet a = 3 | math.pow 2
parses tolet a =
&3 | math.pow 2
is because that would parsejoin foo=bar (==id)
tojoin foo=
&bar (==id)
, which isn't right. If we had different syntax for aliases vs. assignments, then we could bind=
in the first example tighter, and require fewer parentheses.But this was the best tradeoff we could come up with. (Lots of old issues on this that are required context to make progress here...)