incorrect parsing

Simon Marlow simonmar at microsoft.com
Fri Jan 4 04:46:20 EST 2002


> On Thu, Jan 03, 2002 at 05:27:43PM -0000, Simon Marlow wrote:
> > 
> > 	'(' exp(i+1) op(a,i) ')'
> > 	'(' op(a,i) exp(i+1) ')'
> > 
> > 	'(' lexp(i) op(l,i) ')'
> > 	'(' op(r,i) rexp(i) ')'
> > 
> > And for the sake of fewer ambiguities, replace each op(a,i) 
> with op(n,i)
> > in the existing two section productions.
> 
> (+ 5) would not then be valid.

Oops, quite right.  Then we should follow the example of the lexp/rexp
productions:

	'(' (lexp(i) | exp(i+1)) op(l,i) ')'
	'(' op(r,i) (rexp(i) | exp(i+1)) ')'
	'(' op(n,i) exp(i+1) ')'
	'(' exp(i+1) op(n,i) ')'

Yeuch.  The grammar would be much more readable (not to mention
parseable) if fixity resolution was described seperately.

Cheers,
	Simon




More information about the Glasgow-haskell-bugs mailing list