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

Hendrik Boom hendrik at topoi.pooq.com
Fri Apr 3 21:41:18 BST 2020


On Fri, Apr 03, 2020 at 11:22:56AM -0700, Jacob Lifshay wrote:
> On Fri, Apr 3, 2020, 08:20 Luke Kenneth Casson Leighton <lkcl at lkcl.net>
> wrote:
...
> > +in_range <-  (x | y) & (a | b)
> > +in_range <-  (x + y) - (a + b)
> > +"""
> >
> 
> since there are parenthesis, precedence between &, |, +, and - doesn't
> actually matter here, so it's not a good example. Traditionally + and -
> have the same precedence whereas & has higher precedence than | so a & b |
> c parses as (a & b) | c.

Presumably because the early logicians treated 'and' as being a multiplication
and 'or' as being an addition.

-- hendrik



More information about the libre-riscv-dev mailing list