ISO/IEC JTC1 SC22 WG17
Comparison of implementations of phrase/2 and phrase/3

ISO Prolog works.

#Queryanswer description
with errors from 13211-1:1995 and 8.18.1.3
SICStus
4.9.0
Scryer
0.9.4
Trealla
2.52.25
GNU
1.6.0
Ichiban
1.2.0
ECLiPSe
7.0#42 -L iso
Tau
0.3.4
SWI
9.3.4
X
1.0.63
YAP
7.4.0
XSB
5.0.0
B
7.8b7
Ciao
1.23.0
Minerva
2.4
IF
V5.1B
#Queryanswer description SICStus Scryer Trealla GNU Ichiban ECLiPSe Tau SWI X YAP XSB B Ciao Minerva IF
c1 ?- call(1). type_error(callable,1). OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK
c2 ?- call((1,fail)). type_error(callable,(1,fail)). OK OK OK OK OK OK OK OK OK OK t._e.(c.,1) t._e.(c.,1) t._e.(c.,1) t._e.(c.,1) t._e.(c.,1)
c3 ?- call((fail,1)). type_error(callable,(fail,1)). OK OK OK OK OK OK OK OK OK OK t._e.(c.,1) false false false OK
c4 ?- call((!;1)). type_error(callable,(!;1)). OK OK OK OK OK OK OK OK OK true OK true true true OK
c5 ?- call((!;\+1)). true. OK OK OK OK OK OK OK t._e.(c.,...) OK OK OK OK OK OK OK
c6 ?- call((!;call(1))). true. OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK
c7 ?- call((\+!;X=a)). X=a. OK OK OK OK OK OK OK OK OK OK OK OK Warning OK OK
f1 ?- functor(T,F,A). instantiation_error. OK OK OK OK OK OK OK OK OK OK OK OK false OK OK
f2 ?- functor(T,1,2). type_error(atom,1). OK OK OK OK OK OK OK OK OK OK false OK false OK OK
1 ?- phrase(=,L). L = []
| existence_error(non_terminal,(=)//0).
L. L. L. L. L. L. L. L. L. L. L. L. L. L. L.
2 ?- phrase(1,L). type_error(callable,1). OK OK OK OK OK OK OK OK OK OK false t._e.(a.,1) false t._e.(a.,1) t._e.(a.,1)
24 ?- asserta((a-->b)). permission_error(modify,static_procedure,(-->)/2). OK user: OK OK true true OK true true true true OK true true true OK
25/**/ ?- clause((a-->b),B). permission_error(access,private_procedure,(-->)/2). OK user: OK OK B=true B=true OK B=true B=true B=true p._e.(a.,s._p.,(-->)/2) OK B=true B='bas.:true' B=true false
26 ?- (X-->Y). existence_error(procedure,(-->)/2). context_e.(q.,cl._or_di.) OK OK OK OK throw(abort) OK OK OK X= ...,Y= (call(A);call(B)) OK OK e._e.(p.,'user:-->'/2) OK OK
3 ?- phrase(!,L). L = []. OK OK OK OK OK OK OK OK OK OK OK OK OK e._e.(p.,!/2),
e._e.(p.,'.'/4) etc.
like call/3
4 ?- phrase([a],L). L = [a]. OK OK OK OK OK OK OK OK OK OK OK OK OK
5 ?- phrase([a|a],L). type_error(list,[a|a]). OK OK OK OK OK t._e.(t._s.,a) OK* t._e.(l._o._p.,[a|a]) false false misc_error e._e.(p.,a/2) e._e.(p.,a/2)
6 ?- phrase([a|L],K). instantiation_error. OK OK OK OK OK OK OK* L = [], K = [a] ; ... L = [], K = [a] ; ... L = [], K = [a] ; ... misc_error OK OK
38 ?- phrase([a|L],L). instantiation_error. OK OK OK OK OK OK OK* loops loops loops misc_error loops false
7 ?- phrase([a|L],[a,b]). instantiation_error. OK OK OK OK OK OK OK* L = [b] L = [b] L = [b] misc_error OK OK
8 ?- phrase([a|L],[]). instantiation_error. OK OK OK OK OK OK OK* false false false misc_error false false
9 ?- phrase(([a],[]),[a]). true. OK OK OK OK OK OK OK OK OK t._e.(c.,[a]) OK OK OK
10 ?- phrase(([a],{1}),[]). type_error(callable,(...,...)). OK OK t._e.(c.,1) false OK false OK OK false t._e.(c.,[a]) t._e.(c.,1) false false
37 ?- phrase((!,[a],{1}),[]). type_error(callable,(...,...)). OK OK t._e.(c.,1) OK OK false OK OK false t._e.(c.,[a]) t._e.(c.,1) false false
11 ?- phrase(({!,fail};[]),L). false. OK OK OK OK L=[] OK OK OK L=[] e._e.(p.,(;)/4) OK OK OK
12 ?- phrase('|'([],[a]),[a]). true. e._e.(p.,'|'/4) OK OK OK OK OK e._e.(p.,'|'/4) OK OK e._e.(p.,t_./6) e._e.(p.,'|'/4) OK OK
13 ?- phrase(({fail},1),L). type_error(callable,1). OK OK OK OK OK OK t._e.(c.,({fail},1)) OK false false false t._e.(a.,1) false
14 ?- phrase(([a];[]),L). L = [a] ; L = []. OK OK OK OK OK OK L = [] OK OK e._e.(p.,(;)/4) OK OK OK
15 ?- phrase({fail,1},L). type_error(callable,((fail,1),[]=_A))
| type_error(callable,((fail,1),...)).
OK OK OK OK OK false OK OK t._e.(c.,(fail,1)) t._e.(c.,(fail,1)) t._e.(c.,1) false false
16 ?- phrase({throw(h)},[a]). throw(h). OK OK OK OK OK OK OK OK OK OK OK false OK
17 ?- phrase(({L=[]},[a|L]),[a]). instantiation_error. OK OK OK OK OK OK OK* L = [] L = [] t._e.(c.,[a]) misc_error L = [] false
18 ?- phrase([a|L],K), L=[b]. instantiation_error. OK OK OK OK OK OK OK* K = [a,b] ; loops K = [a,b] ; loops K = [a,b] ; loops misc_error OK OK
19 ?- phrase(([a|L],1),[]). type_error(callable,1)
| instantiation_error.
i. i. i. i. i. i. t._e.(c.,([a|L],1))) t. false t._e.(c.,[a|_]) misc_error t._e.(a,1) false
20 ?- phrase((1,[a|L]),[]). type_error(callable,1)
| instantiation_error.
t. i. t. t. t. t. t._e.(c.,(1,[a|L]) t. t. t. false t._e.(a,1) false
21 ?- phrase((1,[a|a]),[]). type_error(callable,1)
| type_error(list,[a|a]).
c. l. c. c. c. c. t._e.(c.,(1,[a|a])) c. c. c. false t._e.(a.,1) false
22 ?- phrase('|'(([x]->[y]),[z]),L). representation_error(dcg_body)
| L=[x,y].
e._e.(p.,'|'/4) r. r. L=[x,y] L=[x,y] L=[x,y];L=[z] e._e.(p.,'|'/4) L=[x,y] L=[x,y];L=[z] e._e.(p.,t_./6) e._e.(p.,'|'/4) L=[x,y] L=[x,y]
23 ?- phrase(;(([x]->[y]),[z]),L). L=[x,y]. OK OK OK OK OK OK OK OK OK e._e.(p.,(;)/4) s._e. OK OK
27 ?- phrase(\+[a],[]). representation_error(dcg_body)
| true.
true r. r. true true true true true e._e.(p.,(\+)/3) e._e.(p.,t_b./6) true e._e.(p.,(\+)/3) true
28 ?- phrase(\+1,L). representation_error(dcg_body)
| type_error(callable,1).
t. r. r. t. t. t. t.* t. e._e.(p.,(\+)/3) e._e.(p.,t_b./6) false e._e.(p.,(\+)/3) false
29 ?- phrase(([a],\+1),[]). representation_error(dcg_body)
| false.
t._e.(c.,1) r. r. t._e.(c.,1) t._e.(c.,1) t._e.(c.,1) t._e.(c.,1) t._e.(c.,1) false t._e.(c.,[a]) false false false
30 ?- phrase(([a],\+1;[]),[]). representation_error(dcg_body)
| true.
t._e.(c.,1) r. r. t._e.(c.,1) t._e.(c.,1) t._e.(c.,1) t._e.(c.,1) t._e.(c.,1) true e._e.(p.,t_b./6) false true false
31 ?- phrase(phrase(phrase,[]),L). existence_error(procedure,phrase/4)
| existence_error(non_terminal,phrase//2)
| L = [].
e. user:p./4 L = [] L = [] e. p./4 e. p./4 e. p./4 e. p./4 e. p./4 e. p./4 e. p./4 e. p./4 e. p./4 e. 'u.:p.'/4
32 ?- phrase(call([]),[]). existence_error(procedure,[]/2)
| true.
e. user:[]/2 e. e. e. e. e. e. e. e. true e. usermod:[]/2 e. e. 'u.:call'/3
33 ?- L=[],phrase([a|L],[b]). false. OK OK new OK OK OK OK OK OK OK OK new OK OK OK
36 ?- L=[],phrase([a|L],[a]). L=[]. OK OK OK OK OK OK OK OK OK OK OK OK false
34 ?- phrase([a],[b]). false. OK OK OK OK OK OK OK OK OK OK new OK OK OK
35 ?- phrase(!,[_]) ; L=1. L=1. OK false OK OK OK OK OK OK OK OK OK OK false
?- phrase([], non_list). false
| type_error(list,non_list).
?- phrase([], [a|non_list]). false
| type_error(list,[a|non_list]).
?- phrase([], 1). false
| type_error(list,1).
?- phrase([], L,non_list). L = non_list
| type_error(list,non_list).
?- phrase([], L,[a|non_list]). L = [a|non_list]
| type_error(list,[a|non_list]).
classmeaning
regregular use
goodconforming
corpcorrect but problematic
badcerror's culprit wrong
badterror's type wrong
badeerror class wrong
badrrejection unexpected
badmmisinterpretation
badvvulnerability
* error(E, Imp_def) :- throw(error(E, Imp_def)). added to Tau

ad #31: phrase//2 as implementation specific extension:
2021-12-21 first suggested
2024-01-11 added to Scryer
2024-01-12 added to Trealla


Version Control, Validated HTML