1

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.

4
  • 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. Commented Jun 29, 2016 at 9:29
  • if you could email me an example to trigger the error message, that would be great! Commented Jun 29, 2016 at 9: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. Commented Jun 29, 2016 at 11:46
  • thanks and no problem! keep the questions coming; very helpful for other users. Commented Jun 29, 2016 at 12:03

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.