[m-users.] "operator precedence error" - Mercury bug?

Julien Fischer jfischer at opturion.com
Sat Oct 12 22:17:17 AEDT 2019


On Sat, 12 Oct 2019, Volker Wysk wrote:

> Am Samstag, den 12.10.2019, 20:00 +1100 schrieb Julien Fischer:
>> Hi Volker,
>>
>> On Sat, 12 Oct 2019, Volker Wysk wrote:
>>
>>> This simple module won't compile:
>>>
>>> :- module test1.
>>> :- interface.
>>> :- import_module char.
>>> :- pred f(char::in) is semidet.
>>>
>>> :- implementation.
>>>
>>> f(A) :-
>>>    A = '/'.
>>
>> You need to escape that using parentheses.
>>
>>     f(A) :-
>>        A = ('/').
>>
>> Otherwise the compiler will treat that as the '/' operator.
>> (Mercury doesn't have a specific syntax for character literalsm,
>> they're
>> just atoms.)
>
> Hmm.. Couldn't find it in the Language Reference Manual.

Unfortuantely, it's one of those gaps in the reference manual that is
explained away by:

     Syntactically, terms in Mercury are exactly the same as in ISO Prolog,
     except that as extensions we permit ...

(It would be preferable for the language reference to be more
self-contained.)

Julien.


More information about the users mailing list