H98 Report: expression syntax glitch

Ross Paterson ross@soi.city.ac.uk
Tue, 26 Feb 2002 16:06:04 +0000


On Tue, Feb 26, 2002 at 07:30:44AM -0800, Simon Peyton-Jones wrote:
> Replace "The ambiguity is resolved by the meta rule that each of these
> constructs extends as far to the right as possible" by
> 
> 	"The ambiguity is resolved by the meta rule that each 
> 	of these constructs extends to the nearest occurrence of
> 	the following punctuation symbols that does not form part of
> 	a nested expression:
> 
> 		)  ]  }  |  ;  ,  ..  where  of  then  else

I didn't think this was going to be pretty, but it doesn't quite work
either.  There's no ambiguity in

	(let x = 10 in x `div`)

The context-free grammar gives exactly one parse for this, and we
want to disallow it.  It seems you need to retain the old meta-rule
for the ambiguities but also explicitly exclude certain forms.