## Parse error when having ambiguities

I have this small example of an ambiguous grammar that doesn’t return the result I’m expecting:

module Testexports

context-free start-symbols

Expcontext-free syntax

Id -> Exp {cons(“Exp2Id”)}`Exp "+" Exp -> Exp {left, cons("Plus")} ID -> Id {cons("Id")}`

lexical syntax

[A-Z][a-zA-Z0-9]* -> VarId

[a-zA-Z][a-zA-Z0-9_]* -> IDcontext-free syntax

VarId -> Id {cons(“Id2Var”)}

VarId -> Exp {cons(“Exp2Var”)}This is the returned AST for “A+B”:

amb(

[ amb(

[Exp2Var(“A”), Exp2Id(amb([Id2Var(“A”), Id(“A”)]))]

)

, amb(

[Exp2Var(""), Exp2Id(amb([Id2Var(““), Id(””)]))]

)

]

)“A” is parsed correctly, but “B” is missing.

Submitted by Radu Mereuta on 18 May 2011 at 14:56

Am I doing something wrong, or is this a JSGLR error? I really need the correct parsing, with all of the ambiguities.

## Attachments

AB.af | 22 May 2011 at 13:01 |

## Issue Log

This seems to be a problem with the new ambiguity handling approach, not the imploder. Maartje, could you take a look? The internal representation shows the following ambiguity:

[amb([regular(aprod(278),[regular(aprod(285),[regular(aprod(286),[65, regular(aprod(270),[])])])]), regular(aprod(282),[amb([regular(aprod(279),[regular(aprod(285),[regular(aprod(286),[65, regular(aprod(270),[])])])]), regular(aprod(280),[regular(aprod(283),[regular(aprod(284),[65, regular(aprod(261),[])])])])])])]), regular(aprod(259),[]), regular(aprod(257),[43]), regular(aprod(259),[]), amb([regular(aprod(278),[regular(aprod(285),[regular(aprod(286),[66, regular(aprod(270),[])])])]), regular(aprod(282),[amb([regular(aprod(279),[regular(aprod(285),[regular(aprod(286),[66, regular(aprod(270),[])])])]), regular(aprod(280),[regular(aprod(283),[regular(aprod(284),[66, regular(aprod(261),[])])])])])])])](Note the different ParseProductionNode characters in the branches!)

bug in left associativity filter fixed

*Log in to post comments*