🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #1829

Re: Question about operators

#1829
From: Richard A. O'Keefe
Date: Tue, 19 Feb 1991 11:35
43 lines
1681 bytes
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 ! <<here>> 
no
| ?- portable_read(X), display(X).
|: (a+b!).
** ) cannot start an expression
 ( a + b ! ) <<here>> 
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
Technical Details
Message-ID: <4788@goanna.cs.rmit.oz.au>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!munnari.oz.au!goanna!ok
References: <12166@darkstar.ucsc.edu> <4764@goanna.cs.rmit.oz.au> <1991Feb13.123619.23855@rodan.acs.syr.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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