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
I am trying to use pest to implement a language featuring operators that are left-associative (like +) and non-associative (like <). With other words, a + b + c should translate to (a + b) + c while a < b < c is a syntax error.
I learnt that I can use the PrattParser for precedence parsing. However, when defining operators I merely have the option to make them left or right associative. Is there a preferred way to define non-associative operators?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am trying to use pest to implement a language featuring operators that are left-associative (like
+
) and non-associative (like<
). With other words,a + b + c
should translate to(a + b) + c
whilea < b < c
is a syntax error.I learnt that I can use the
PrattParser
for precedence parsing. However, when defining operators I merely have the option to make them left or right associative. Is there a preferred way to define non-associative operators?See also
Beta Was this translation helpful? Give feedback.
All reactions