Search Mailing List Archives
[p4-feedback] Why does the expression editor remove essential parentheses?
sielists at gmail.com
Sun Apr 26 17:21:02 PDT 2009
I just came across this same issue. If I understood your previous post
correctly you are saying that OR has a higher precedence than AND but my
understanding is the opposite. The description editor is behaving as if
OR has a higher precedence than AND but this is not what the Manchester
syntax says. Is this discrepancy intentional or am I misunderstanding
The current W3 BNF for the syntax
shows that A AND B OR C will be first parsed as (A AND B) OR (C) instead
of the other way around (A) AND (B OR C) (the way the description editor
is parsing the text).
The precedence order is described more clearly in your paper about the
Manchester syntax "The Manchester OWL Syntax" at
> Precedence The Manchester OWL Syntax encourages the minimisation of the
> number of brackets that are used. This is achieved using operator
> precedence for
> class descriptions. The following list summarises operator precedence
> – operators
> are shown from highest precedece to lowest precedence.
> – SOME, ALL, VALUE, MIN, MAX, EXACTLY, THAT
> – NOT
> – AND
> – OR
This was described as a bug in this post
but I didn't find a bug report for it.
> Hi Patrick,
> I just looked at this and I think the issue is just the rendering. Or
> appears to have greater precedence than and in the Man Syntax.
> A and B or C is parsed as
> A and (B or C)
> We should probably retain the brackets to make this clearer (as it depends
> what your background is whether this is intuitive - C has && as higher
> precedence for example).
> The reason the rendering changes on a reload is p4 remembers the expression
> as you typed it until it is restarted.
More information about the p4-feedback