0

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.

  • 1
    Hi Olav, since the renderer and dr. ambiguity are written in Rascal itself, it may be that their own code runs into ambiguity or one of the libraries used have changed semantics without triggering a test failure. Both the renderer and dr. ambiguity are ill tested. I'll have a look and check both programs to see what's going on. – Jurgen Vinju Jun 29 '16 at 09:29
  • if you could email me an example to trigger the error message, that would be great! – Jurgen Vinju Jun 29 '16 at 09:30
  • Email is sent. Sorry for posting a potential bug at Stackoverflow instead of reporting it on GitHub (again). I hadn't expected this would be a problem in Rascal. – Olav Trauschke Jun 29 '16 at 11:46
  • thanks and no problem! keep the questions coming; very helpful for other users. – Jurgen Vinju Jun 29 '16 at 12:03

1 Answers1

1

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.