RE: Precedence rules for QuantifiedExpr - OrExpr - AndExpr

Not sure this still belongs on the list....let me know if it does not.

> 
> 
> Peter Coppens wrote:
> > 
> > I always thought that the EBNF (A.1) and the precedence rules (A.4) 
> > contain "duplicate" information.
> 
> They should. Section A.4 bills itself as a summary of the 
> precedence defined in section A.1 (and thus, should perhaps 
> be non-normative).

A.4 also contains 

"In the cases where a number of operators are a choice at the same
production level, the expressions are always evaluated from left to right".

Is this reflected in the EBNF? If so, I am not sure I understand how that is
done.

To give a more common example: $v1 div $v2 * $v3. I assume this falls under
: UnaryExpr ( ("*" | "div" | "idiv" | "mod") UnaryExpr )*, which I think is
ambiguous without the "A.4" sentence.



> Parsing "some $v in $X satisfies A or B" as
> 
>                         OrExpr
>                           |
>              +------------+-----------+
>              |            |           |
>           AndExpr        "or"      AndExpr
>              |                        |
>         QuantifiedExpr                B
>              |
>     some $v in $X satisfies A
> 
> is disallowed by Section A.1, because AndExpr does not derive 
> QuantifiedExpr.
Thanks. I missed that....but does that not mean that "some $v in $X
satisfies A or B" should result in a syntax error according to the current
EBNF? 

> 
> However, section A.4 does not convey this, which leads to 
> confusion. The fix is presumably to move "or" from precedence 
> level 2 to a new level between the current levels 2 and 3. I 
> think this is what you meant by
> 
> > > (3) would it not be possible to add an extra level of precendence 
> > > where the OrExpr comes to sit between QuantifiedExpr and AndExpr
> 
> though I'm not sure.
That is what I meant yes. But I have a feeling that needs to be reflected in
a modified EBNF as well. 

> 
> -Michael Dyck
> 

Received on Sunday, 21 December 2003 07:40:58 UTC