[PPL-devel] [Fwd: Re: Any Prolog language lawyer out there?]

Roberto Bagnara bagnara at cs.unipr.it
Thu Oct 21 10:52:15 CEST 2004



-------- Original Message --------
Subject: Re: Any Prolog language lawyer out there?
Date: 21 Oct 2004 01:15:45 -0700
From: matsc at sics.se (Mats Carlsson)
Organization: http://groups.google.com
Newsgroups: comp.lang.prolog
References: <41750912.8040102 at cs.unipr.it> <1098196164.417498 at seven.kulnet.kuleuven.ac.be> <slrncnaat8.jkn.jan at ct.xs4all.nl> <87acuijutl.fsf at gondolin.bb.bawue.de> <1098259920.942884 at seven.kulnet.kuleuven.ac.be> <1098274154.598785 at seven.kulnet.kuleuven.ac.be>

I made a mistake in my previous posting, so here goes again.

Bart Demoen <bmd at cs.kuleuven.ac.be> wrote in message news:<1098274154.598785 at seven.kulnet.kuleuven.ac.be>...
> I wrote:
> 
> > Goal     : integer(- 4)
> > Specification result :     Must fail
> > 
> > 
> > 
> > Goal     : integer(-4)
> > Specification result :     Must succeed
> > 
> > 
> > So it seems that the space between the - and the 4 is important.
> > 
> > I do not have the final copy of the standard, and although I do remember
> > that there has been discussion about it, I do not remember the final 
> > outcome,
> > so can anybody check that's indeed what the standard says ?
> 
> I got hold of a standard ...
> 
> It says at the end of section that Jens was quoting from:
> 
> "A term which is the name - followed directly by a numeric constant,
> denotes the corresponding negative constant"
> 
> In the standard "directly" means something like "with no space in between".

That must be wishful thinking on your part.  There is no such
definition of "directly" in the document.  I too have the standard
document, from which I quote the relevant grammar rules:

6.3.1.2 Negative Numbers

         term = name, integer ;
         term = name, float number ;

         /* where the name must be '-' */

6.4 Tokens

         name = [ layout text sequence ], name token ;

         integer = [ layout text sequence ], integer token ;

         float number = [ layout text sequence ], float number token ;

6.4.1 Layout text

         layout text sequence
              = layout text,
                { layout text } ;

         layout text
              = layout char
              | comment ;


So clearly, there can be space, even comments, between the '-'
and the digits.  BTW, the same applies to [/*this atom*/] and {/*this atom*/}.

> That decides the issue I think: - 4 should not be read as a negative integer;

To the contrary, it should.

--Mats

-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it



More information about the PPL-devel mailing list