[m-users.] Free and Ground in the same error line?

Zoltan Somogyi zoltan.somogyi at runbox.com
Sat Oct 28 21:42:08 AEDT 2023


On 2023-10-28 21:36 +11:00 AEDT, "Volker Wysk" <post at volker-wysk.de> wrote:
> You don't have an "else" for your second "if".

That is clearly the source of the error in Sean's program, but there is
another issue here. The Mercury reference manual lists if-then-else
as a DCG goal type, but does NOT list if-then without else as a DCG goal type.
On the other hand, the DCG goal parser in the compiler does accept
else-less if-then DCG goals. This seems to be either an oversight in the parser,
or, more likely, a hangover from the ancient past. Either way, it seems to be
the cause of the lack of a direct error message for situations like this.

Zoltan.


More information about the users mailing list