This syntax, where the Add constructor is indirectly (through BinOp) defined on Exp:

Exp.Var             = <<ID>>
Exp                 = BinOp
BinOp.Add           = <<Exp> + <Exp>> {left}

parses the following example:

x + y + z

ambiguously:

amb([
    Add(Add(Var("x"), Var("y")), Var("z")),
    Add(Var("x"), Add(Var("y"), Var("z")))
])

because the associativity is ignored.


However, defining the Add constructor directly on Exp:

Exp.Var             = <<ID>>
Exp.Add             = <<Exp> + <Exp>> {left}

works as expected.

Submitted by D. Pelsmaeker on 14 August 2014 at 14:31


On 14 August 2014 at 14:46 Guido Wachsmuth closed this issue.

Log in to post comments