H98 Report: expression syntax glitch

Simon Peyton-Jones simonpj@microsoft.com
Tue, 26 Feb 2002 08:23:03 -0800

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=20
	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 =3D 10 in x `div`) would be rejected because=20
	x `div`
isn't a exp.


| -----Original Message-----
| From: Ross Paterson [mailto:ross@soi.city.ac.uk]=20
| Sent: 26 February 2002 16:06
| To: Simon Peyton-Jones
| Cc: haskell@haskell.org
| Subject: Re: H98 Report: expression syntax glitch
| On Tue, Feb 26, 2002 at 07:30:44AM -0800, Simon Peyton-Jones wrote:
| > Replace "The ambiguity is resolved by the meta rule that=20
| each of these=20
| > constructs extends as far to the right as possible" by
| >=20
| > 	"The ambiguity is resolved by the meta rule that each=20
| > 	of these constructs extends to the nearest occurrence of
| > 	the following punctuation symbols that does not form part of
| > 	a nested expression:
| >=20
| > 		)  ]  }  |  ;  ,  ..  where  of  then  else
| I didn't think this was going to be pretty, but it doesn't=20
| quite work either.  There's no ambiguity in
| 	(let x =3D 10 in x `div`)
| The context-free grammar gives exactly one parse for this,=20
| and we want to disallow it.  It seems you need to retain the=20
| old meta-rule for the ambiguities but also explicitly exclude=20
| certain forms.