H98 Report: expression syntax glitch

Carl R. Witty cwitty@newtonlabs.com
01 Mar 2002 11:24:42 -0800

"Simon Peyton-Jones" <simonpj@microsoft.com> writes:

> I didn't phrase it right.   I meant that a let/lambda/if always
> extends to the next relevant (not part of a smaller expression)
> punctuation symbol; and if that phrase parses as an exp
> that's fine, otherwise it's a parse error.  So I should not really
> speak in terms of 'ambiguity'.
> Perhaps we can simply say that 
> 	let .. in exp
> is legal only if the phrase is followed by one of the punctuation
> symbols.  That's nice, because we don't need to talk of
> "not part of a smaller expression".
> So (let x = 10 in x `div`) would be rejected because 
> 	x `div`
> isn't a exp.

If you're going to modify the syntax in the report to match what
implementors actually implement, you may also want to change the
"illegal lexeme" definition for closing implicit layout.  I believe
  do a == b == c
is (according to the Standard) legal syntax that means
  (do {a == b}) == c
but I'll bet that most if not all Haskell parsers would get it wrong.

Carl Witty