Need help redefining rules to avoid left recursion and have precedence #816
Answered
by
tomtau
SlashScreen
asked this question in
Q&A
-
I have these rules here, to allow nested binary operations. I'm using 1==2 && 3==4 as a test input.
But if I write it like this, it has a precedence issue:
As i, instead of parsing it as (1==2)&&(3==4)), it reads it as (1 == (2 && (3 == 4)). How do I rewrite this to read it as expected? |
Beta Was this translation helpful? Give feedback.
Answered by
tomtau
Feb 28, 2023
Replies: 1 comment
-
It can be done outside the grammar using |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
tomtau
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It can be done outside the grammar using
PrattParser
: https://pest.rs/book/precedence.html