[Haskell-beginners] Operator orders affect parse result
Francesco Ariis
fa-ml at ariis.it
Mon Apr 13 08:12:20 UTC 2015
On Mon, Apr 13, 2015 at 03:49:43PM +0800, m00nlight wrote:
> Hi Francesco,
>
> Thanks for your reply. But after I change the aOperators like the following, it still produce non-correct parse result.
>
> aOperators = [ [Prefix (reservedOp "-" >> return (Neg ))]
> , [ Infix (reservedOp "*" >> return (ABinary Divide )) AssocLeft,
> Infix (reservedOp "/" >> return (ABinary Multiply )) AssocLeft]
> , [Infix (reservedOp "+" >> return (ABinary Add )) AssocLeft,
> Infix (reservedOp "-" >> return (ABinary Subtract )) AssocLeft]
> ]
Check those lines:
, [ Infix (reservedOp "*" >> return (ABinary Divide )) AssocLeft,
Infix (reservedOp "/" >> return (ABinary Multiply )) AssocLeft]
Divide should go on the same line of "/", not "*"! Similar fix for Multiply!
More information about the Beginners
mailing list