[PPL-devel] Any Prolog language lawyer out there?
Roberto Bagnara
bagnara at cs.unipr.it
Tue Oct 19 14:31:14 CEST 2004
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 at cs.unipr.it
More information about the PPL-devel
mailing list