Any Prolog language lawyer out there?

From: Roberto Bagnara (bagnara_at_cs.unipr.it)
Date: 10/19/04


Date: Tue, 19 Oct 2004 12:31:07 GMT


I have just been bitten by a problem that seems to be caused
by the different ways different Prolog systems parse the
string "+4*a". Here are the results of a little experiment:

$ ciao
Ciao-Prolog 1.10 #5: Sat Aug 7 14:07:02 CEST 2004
?- write_canonical(+4*a).
*(+(4),a)
yes
?-

$ gprolog
GNU Prolog 1.2.18
By Daniel Diaz
Copyright (C) 1999-2004 Daniel Diaz
| ?- write_canonical(+4*a).
*(+(4),a)

yes
| ?-

$ sicstus
SICStus 3.11.1 (x86-linux-glibc2.3): Fri Feb 20 18:38:25 CET 2004
Licensed to math.unipr.it
| ?- write_canonical(+4*a).
*(4,a)
yes
| ?-

$ pl
Welcome to SWI-Prolog (Multi-threaded, Version 5.4.1)
Copyright (c) 1990-2003 University of Amsterdam.
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.

For help, use ?- help(Topic). or ?- apropos(Word).

?- write_canonical(+4*a).
*(4, a)

Yes
?-

$ xsb
[xsb_configuration loaded]
[sysinitrc loaded]
[packaging loaded]

XSB Version 2.6 (Duff) of June 24, 2003
[i686-pc-linux-gnu; mode: optimal; engine: slg-wam; gc: indirection; scheduling: local]

| ?- write_canonical(+4*a).
+(*(4,a))
yes
| ?-

$ yap
[ Restoring file /usr/local/lib/Yap/startup ]
[ YAP version Yap-4.5.1 ]
    ?- write_canonical(+4*a).
*(4,a)yes
    ?-

Am I correct if I say that all the 6 tested systems are /not/ violating
the ISO Prolog standard because unary plus is not mentioned in its Table 7
(p. 19) and thus its presence and priority are implementation-defined?
All the best,

     Roberto

P.S. Standard or not standard, I find all this quite striking.

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


Relevant Pages

  • Re: Any Prolog language lawyer out there?
    ... This is of course a bit undesirable as the tokeniser returns atoms, ... and floats as Prolog objects. ... the only reason to interpret the - in "-4" as an operator is if we ... Does the official standard document document say anything about handling ...
    (comp.lang.prolog)
  • Re: Promoting Forth (Re: EuroForth 2008 workshop "Forth is dying")
    ... number of Forth systems come with manuals, and it seems to me that ... is that the name of his newer language does not contain "Modula". ... Prolog: ISO Prolog is based on Edinburgh Prolog, not Marseille Prolog, ... I think he has stated himself that he is not interested in a standard; ...
    (comp.lang.forth)
  • Re: mainstreaming Prolog
    ... For the ISO Standard definition to Prolog please see ... interfaces and try to stay one step ahead of what the users require. ... Prolog standard took more than 10 years to formulate and is one of the ...
    (comp.lang.prolog)
  • comp.lang.prolog Frequently Asked Questions
    ... Improve section about the Prolog ISO standard. ... What is the Association for Logic Programming? ... Platforms: Window, Linux and Solaris ...
    (comp.lang.prolog)
  • comp.lang.prolog Frequently Asked Questions
    ... Improve section about the Prolog ISO standard. ... What is the Association for Logic Programming? ... Platforms: Window, Linux and Solaris ...
    (comp.lang.prolog)