Article View: comp.lang.prolog
Article #301DCG expansion pitfall
From: Mats Carlsson
Date: Tue, 05 Sep 1989 07:22
Date: Tue, 05 Sep 1989 07:22
22 lines
924 bytes
924 bytes
Implementors and users, check how your favourite Prolog expands the
DCG clause:
p(X) -->
( {test(X)} -> []
; [token(X)]
).
It should expand to something equivalent to
p(A, B, C) :-
( test(A) ->
B = C
; B = [token(A)|C]
).
This is yet another example of the unfortunate fact that (P;Q) is not
equivalent to ((true,P);Q) if P = (If->Then).
--
Mats Carlsson
SICS, PO Box 1263, S-164 28 KISTA, Sweden Internet: matsc@sics.se
Tel: +46 8 7521543 Ttx: 812 61 54 SICS S Fax: +46 8 7517230
Technical Details
Message-ID:
<MATSC.89Sep5092248@skarabe.sics.se>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!sunic!sics.se!sics.se!matscShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!sunic!sics.se!sics.se!matsc From: matsc@sics.se (Mats Carlsson) Newsgroups: comp.lang.prolog Subject: DCG expansion pitfall Message-ID: <MATSC.89Sep5092248@skarabe.sics.se> Date: 5 Sep 89 07:22:48 GMT Sender: news@sics.se Distribution: comp Organization: Swedish Institute of Computer Science, Kista Lines: 22