[mercury-users] rule is a reserved word?

Gustavo A. Ospina gos at info.fundp.ac.be
Mon Jun 7 18:46:22 AEST 1999


Hi. First of all thanks all Mercury team for an really good programming
language. I'm really in love with it.

I've found a strange error that I want to show with the following code:

%----------------------------------------
:- module foo.

:- interface.

:- type rule --->
	foo1 ; foo2 ; foo3.

:- pred foo(rule, int).
:- mode foo(in, out) is det.

:- implementation.

foo(foo1, 1).

foo(foo2, 2).

foo(foo3, 3).
%----------------------------------------

The compiler (version 0.8.1, running on a PC with Windows NT and cygwin
b20) rejects this with these messages:

bash-2.02$ mmc -c foo.m
foo.m:005: Syntax error at token 'rule': unexpected token at start of
(sub)term.
foo.m:008: In definition of predicate `foo:foo'/2:
foo.m:008:   error: undefined type `rule'/0.
For more information, try recompiling with `-E'.

Really I've found this error when I was making a program to implements a
grammar. I want to define a type 'rule' to represent grammar rules and the
compiler rejects my module, so I had to change the name to 'regle'.

The unique explanation I see is that 'rule' should be a reserved word. But
I don't know what is its usage. I would like to know what is the real usage
of the word 'rule' (some pragma? declaration?) or if it's an error.

Best regards and good luck.

+ Gustavo.


--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list