Second draft of the Haskell 2010 report available

Christian Maeder Christian.Maeder at dfki.de
Wed Jul 7 10:47:47 EDT 2010


Simon Marlow schrieb:
> On 06/07/2010 13:17, Christian Maeder wrote:
>>
>> http://www.haskell.org/~simonmar/haskell-2010-draft-report-2/haskellch3.html
>>
>>
>> infixexp →     lexp qop infixexp (infix operator application)
>>     |     - infixexp           (prefix negation)
>>     |     lexp
>>
>> This grammar rule describes a right associative nesting of (any) infix
>> operators "qop" and prefix negation as binding weaker than any infix.
>>
>> Thus a parser would create from "- 1 /= 1&&  a" the tree
>>   "- (1 /= (1&&  a))".
> 
> The grammar is non-ambiguous and all you have to do is flatten the
> result to apply fixity resolution.  I don't really see how generalising
> the grammar would help - the tree still has to be flattened to apply
> fixity resolution, and the parser would have to make an arbitrary choice
> from one of the possible parses.  Or perhaps I'm missing something here?

An ambiguous grammar (as abstract syntax for expressions) would cover
the tree after fixity resolution, too.

The non-ambiguous grammar only describes a temporarily wrong tree for
fixity resolution.

Christian








More information about the Haskell-prime mailing list