Search code examples
parsingambiguityrascal

Ambiguity error while rendering parse tree


In Rascal, when rendering a parse tree, on an ambiguous grammar, why do I sometimes get an error message stating "Ambiguity" at some location instead of Rascal just rendering a parse forest and showing the ambiguity?

I always just call render(renderParsetree(parse(SomeSymbol, SomeLocation))); but I have no clue about when this just renders a parse forest and when it presents an error message about ambiguity. In my opinion the parse forests display ambiguity much clearer and I would like to know if a way exists to show it instead, when Rascal presents the error message.

Edit: Not just rendering a parse tree but even 'Dr. Ambiguity' (diagnose) fails with an Ambiguity error in these cases so this is no way to find the cause of the ambiguity either.


Solution

  • I received the following answer from jurgenv by email: by a recent change you need to set allowAmbiguity=true when calling parse to allow ambiguity. The behaviour of this method was changed to avoid the parser takes a very long time to process a file that is accidently very ambiguous and allows one to discover ambiguity faster.