Article View: comp.lang.prolog
Article #1878Re: Does Prolog have an unambiguous syntax definition?
From: Micha Meier
Date: Mon, 04 Mar 1991 09:20
Date: Mon, 04 Mar 1991 09:20
160 lines
5678 bytes
5678 bytes
In article <4834@goanna.cs.rmit.oz.au> ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
>... We need a model implementation and a whole lot of
>nasty test cases like this that show that what the standard specifies
>can in fact be done. Thanks to Chris Moss for the syntax tests we do
>have; has someone got an additional collection of examples like this one?
>I would like to fix the public-domain reader.
We have a complex syntax test suite made by Dominique Henry de Villeneuve
some years ago. It takes a Prolog system and checks its behaviour
on various aspects of the Prolog syntax. Since its output is quite lengthy,
I have only made a comparison of the output of SICStus 0.7 and Quintus 2.0.
The difference of the two output files was made with diff -DQUINTUS,
so that the differences are highlighted with #ifdef's.
'error' means that an error was signalled but the execution went further,
'forbidden' means that the test could not be run because it aborts
on this system. The operator tests list the operator definitions
as current_op/3.
No test can be complete, so any suggestions about items that could be
added to the suite are welcome.
--Micha
-------------------------------------------------------------------------------
RESULTS OF TESTS ON OPERATORS
111- multiple definitions: prefix and infix
#ifndef QUINTUS
- a - b. =.. [-,-(a),b]-[]
+ a + b. =.. [+,+(a),b]-[]
#else QUINTUS
- a - b. =.. [-,-a,b]-[]
+ a + b. =.. [+,+a,b]-[]
#endif QUINTUS
#ifndef QUINTUS
fy_yfx_8 fy_yfx_8 fy_yfx_8. =.. [fy_yfx_8,fy_yfx_8(fy_yfx_8)]-[current_op(500,fy,fy_yfx_8),current_op(500,yfx,fy_yfx_8)]
#else QUINTUS
fy_yfx_8 fy_yfx_8 fy_yfx_8. =.. error-[current_op(500,fy,fy_yfx_8),current_op(500,yfx,fy_yfx_8)]
#endif QUINTUS
#ifndef QUINTUS
fy_yfx8 fy_yfx8 fy_yfx8 a. =.. [fy_yfx8,fy_yfx8(fy_yfx8,a)]-[current_op(500,fy,fy_yfx8),current_op(500,yfx,fy_yfx8)]
fy_yfx8 fy_yfx8 fy_yfx8 fy_yfx8. =.. [fy_yfx8,fy_yfx8(fy_yfx8(fy_yfx8))]-[current_op(500,fy,fy_yfx8),current_op(500,yfx,fy_yfx8)]
#else QUINTUS
fy_yfx8 fy_yfx8 fy_yfx8 a. =.. error-[current_op(500,fy,fy_yfx8),current_op(500,yfx,fy_yfx8)]
fy_yfx8 fy_yfx8 fy_yfx8 fy_yfx8. =.. error-[current_op(500,fy,fy_yfx8),current_op(500,yfx,fy_yfx8)]
#endif QUINTUS
112- multiple definitions: postfix and infix
#ifndef QUINTUS
a yf_xfx_8 yf_xfx_8. =.. [yf_xfx_8,yf_xfx_8(a)]-[current_op(500,yf,yf_xfx_8),current_op(500,xfx,yf_xfx_8)]
#else QUINTUS
a yf_xfx_8 yf_xfx_8. =.. [yf_xfx_8,a,yf_xfx_8]-[current_op(500,yf,yf_xfx_8),current_op(500,xfx,yf_xfx_8)]
#endif QUINTUS
#ifndef QUINTUS
a yf_yfx_9 yf_yfx_9 yf_yfx_9. =.. [yf_yfx_9,yf_yfx_9(a),yf_yfx_9]-[current_op(500,yf,yf_yfx_9),current_op(500,yfx,yf_yfx_9)]
a yf_xfy_9 yf_xfy_9 yf_xfy_9. =.. [yf_xfy_9,yf_xfy_9(yf_xfy_9(a))]-[current_op(500,yf,yf_xfy_9),current_op(500,xfy,yf_xfy_9)]
a yf_xfx_9 yf_xfx_9 yf_xfx_9. =.. [yf_xfx_9,yf_xfx_9(yf_xfx_9(a))]-[current_op(500,yf,yf_xfx_9),current_op(500,xfx,yf_xfx_9)]
#else QUINTUS
a yf_yfx_9 yf_yfx_9 yf_yfx_9. =.. error-[current_op(500,yf,yf_yfx_9),current_op(500,yfx,yf_yfx_9)]
a yf_xfy_9 yf_xfy_9 yf_xfy_9. =.. [yf_xfy_9,a,yf_xfy_9(yf_xfy_9)]-[current_op(500,yf,yf_xfy_9),current_op(500,xfy,yf_xfy_9)]
a yf_xfx_9 yf_xfx_9 yf_xfx_9. =.. error-[current_op(500,yf,yf_xfx_9),current_op(500,xfx,yf_xfx_9)]
#endif QUINTUS
RESULTS OF TESTS ON DOT
124- eof instead of fullstop?
#ifndef QUINTUS
aerror-[]
#else QUINTUS
aforbidden-[]
#endif QUINTUS
RESULTS OF TESTS ON INTEGERS
143- conversion char->integer
#ifndef QUINTUS
~. = error-[]
#else QUINTUS
~. = ~ -[]
#endif QUINTUS
RESULTS OF TESTS ON FLOATS
151- a float
#ifndef QUINTUS
float(1.2e). error-[]
#else QUINTUS
float(1.2e). yes-[]
#endif QUINTUS
#ifdef QUINTUS
float(1.2e +6). no-[]
#else QUINTUS
float(1.2e +6). error-[]
#endif QUINTUS
RESULTS OF TESTS ON COMMENTS
180- comments inside Prolog terms
#ifndef QUINTUS
float(10/*comments*/.0). = error-[]
#else QUINTUS
float(10/*comments*/.0). = float(10.0)-[]
#endif QUINTUS
#ifndef QUINTUS
float(10.5e/*comments*/+2). = error-[]
#else QUINTUS
float(10.5e/*comments*/+2). = float(10.5+2)-[]
#endif QUINTUS
181- comments inside Prolog terms
float(10%comments
#ifndef QUINTUS
.0). = error-[]
#else QUINTUS
.0). = float(10.0)-[]
#endif QUINTUS
float(10.5e%comments
#ifndef QUINTUS
+2). = error-[]
#else QUINTUS
+2). = float(10.5+2)-[]
#endif QUINTUS
183- eof inside comments
#ifdef QUINTUS
%commentsa. = error-[]
#else QUINTUS
forbidden
#endif QUINTUS
#ifdef QUINTUS
%a. = error-[]
%a. = error-[]
#else QUINTUS
forbidden
#endif QUINTUS
184- inside comments
#ifdef QUINTUS
/*/a. = error-[]
#else QUINTUS
forbidden
#endif QUINTUS
#ifdef QUINTUS
/* /* /*a. = error-[]
#else QUINTUS
forbidden
#endif QUINTUS
RESULTS OF TESTS ON QUOTED ATOMS
203- null char in the escape sequence of quoted atoms
#ifndef QUINTUS
'a\b'. = error-[]
'a\'. = error-[]
'\b'. = error-[]
#else QUINTUS
'a\b'. = a\ -[]
'a\'. = a\ -[]
'\b'. = \ -[]
#endif QUINTUS
--
E-MAIL micha@ecrc.de MAIL Micha Meier
ECRC, Arabellastr. 17
8000 Munich 81
Germany
Technical Details
Message-ID:
<1991Mar4.092049.573@ecrc.de>Path:
arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!mcsun!unido!ecrc!michaReferences:
<12388@darkstar.ucsc.edu> <4834@goanna.cs.rmit.oz.au>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!mcsun!unido!ecrc!micha From: micha@ecrc.de (Micha Meier) Newsgroups: comp.lang.prolog Subject: Re: Does Prolog have an unambiguous syntax definition? Message-ID: <1991Mar4.092049.573@ecrc.de> Date: 4 Mar 91 09:20:49 GMT References: <12388@darkstar.ucsc.edu> <4834@goanna.cs.rmit.oz.au> Sender: news@ecrc.de Reply-To: micha@ecrc.de (Micha Meier) Organization: European Computer-Industry Research Centre Lines: 160