H98 Report: expression syntax glitch

Simon Marlow simonmar@microsoft.com
Mon, 25 Feb 2002 17:07:35 -0000

> In the table of precedence in the original Report (now deleted in
> the revised Report), it makes it clear that a rightward-extending
> let, if, or lambda has a lower precedence than an infix operator,
> so for instance the parse
>   	h =3D (let op x y =3D y in (3 `op`))
> is correct and
>   	h =3D ((let op x y =3D y in 3) `op`)
> is not.

Actually the table claims that 'let' has a higher precedence than infix =
operators, so your second example above would be the correct parse =
according to the table.  This may be one of the reasons it was removed, =
I can't remember now.

Also, the table wasn't supposed to contain any extra information that =
isn't already in the grammar (Section 3: "As an aid to undertanding the =
grammar, Table 1 shows the relative precedences..."), so if the table is =
required to understand a particular parse, it would indicate a =
deficiency or ambiguity in the grammar.

On the other hand, one way to fix this problem *is* to specify the =
relative precedence of 'let' & co. as compared to infix operators =
(namely that 'let' should have a lower precedence).  That would be a =
reasonable fix for the H98 report, IMO.