-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong operator ordering in FST for operators of equal precedence #162
Comments
This is also true for division and multiplication:
gives:
|
Operators of equal precedence should be parsed in reverse order |
This is happening due to the precedence specified for rply in grammator_operators.py On lines 191-214:
This syntax means that equivalent terms are saved on the right hand side. Thus for the following expression (test_combine_div_modulo_mult in test_grammator_operators.py):
The operator Reversing the syntax to:
leads to the tree being constructed correctly. In this case:
gives:
|
The ordering only needs to be changed for non-commutative operators (i.e. all operators but *). This allows the intuitive ordering to be kept for an example such as:
where first is |
Unfortunately this is not possible. Objects of equal precedence must be examined in the same direction |
When a modulo operator is combined with a multiplication baron does not interpret the code in the same way as python.
E.g:
In python this is equivalent to:
however baron reads it as:
as shown here:
The text was updated successfully, but these errors were encountered: