[libre-riscv-dev] parser precedence, code review / checking needed

Luke Kenneth Casson Leighton lkcl at lkcl.net
Fri Apr 3 16:19:36 BST 2020


if anyone knows how to resolve operator precedence, my logic-dyslexia
is kicking in and i am having difficulty working out which operators
are supposed to be in which order, for bit-wise AND, OR, and
PLUS/MINUS, MUL/DIV.  someone else did the PLUS/MINUS MUL/DIV, i'm
attempting to add AND and OR and am getting it wrong

here's how python-ply is supposed to work:
http://www.dabeaz.com/ply/ply.html#ply_nn27

here's a patch showing the relevant files involved:
https://git.libre-riscv.org/?p=soc.git;a=commitdiff;h=39c8314f9a14fb5351a9dcbc8bd37753bdcd0fee

executing "python3 soc/decoder/power_pseudo.py" is a good test, with
this being good example code:
+cmpi = """
+in_range <-  (x | y) & (a | b)
+in_range <-  (x + y) - (a + b)
+"""

help appreciated.

l.



More information about the libre-riscv-dev mailing list