Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!munnari.oz.au!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.prolog Subject: Re: Question about operators Message-ID: <4788@goanna.cs.rmit.oz.au> Date: 19 Feb 91 11:35:46 GMT References: <12166@darkstar.ucsc.edu> <4764@goanna.cs.rmit.oz.au> <1991Feb13.123619.23855@rodan.acs.syr.edu> Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 43 In article <1991Feb13.123619.23855@rodan.acs.syr.edu>, mitanu@goedel.top.cis.syr.edu (Mitanu Paul) writes: > :- op(550, xf, !), op(550, xfx, !). [This is not accepted as valid syntax:] > ?- X = (a+b!). > Does the parser get confused when confronted with such operators? > Both C-prolog and Quintus prolog produce this error. The version number *does* make a difference. There were versions of C Prolog that should have got this right. There are Prolog systems around that can handle this: % np NU-Prolog 1.5#18 1?- op(550, xf, !), op(550, xfx, !). 2?- display( a+b! ). !(+(a, b)) % sicstus SICStus 0.7 #1: Tue Sep 4 21:39:16 EST 1990 | ?- op(550, xf, !), op(550, xfx, !). | ?- display(a+b!). !(+(a,b)) | ?- compile(tokens), compile(read). % Public-domain parser. | ?- portable_read(X), display(X). |: a+b!. ** expression expected a + b ! <> no | ?- portable_read(X), display(X). |: (a+b!). ** ) cannot start an expression ( a + b ! ) <> no This is a mistake, as the term is quite unambiguous. To users of the public domain Prolog parser, I can only apologise for the mistake. -- Professional programming is paranoid programming