Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!tcdcs!swift.cs.tcd.ie!brady From: brady@swift.cs.tcd.ie Newsgroups: comp.lang.prolog Subject: Re: Does Prolog have an unambiguous syntax definition? Message-ID: <1991Feb13.174251.7784@swift.cs.tcd.ie> Date: 13 Feb 91 17:42:51 GMT References: <12166@darkstar.ucsc.edu> <4764@goanna.cs.rmit.oz.au> Organization: Computer Science Department, Trinity College Dublin Lines: 37 In article <4764@goanna.cs.rmit.oz.au>, ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes: >> Will Prolog display @(#) or #(@), and why is one preferred over the other? > > In a Prolog system whose reader is based on the public-domain parser (the > *point* of providing that was to help implementors tell the truth when they > claimed "Edinburgh" compatibility), the answer must be #(@). > THERE IS NOTHING AMBIGUOUS ABOUT THIS TERM: > if a possible prefix operator is followed by > - a right bracket of some sort , ) | ] } . > - a possible infix operator of wider scope (bigger number) > - or a possible postfix operator of wider scope (bigger number) > then the possible prefix operator is read as an atom. > (In the case of a following infix or postfix operator, this forces > the operator reading.) Surely there _is_ an ambiguity here. If there wasn't, one wouldn't need to consult a programmed parser to resolve it! The DECsystem-10 User's Manual says that under certain circumstances a prefix operator can be taken as an atom. One can reasonably deduce that those circumstances are when there is no valid argument following the possible prefix operator - e.g. where there is a closing bracket, or a stop, or a term of a higher scope following. If that is the case, then, by taking the prefix interpretation of the #, and by turning it into an atom (because it has no following argument), then it seems legal for the prefix @ to take it (i.e. what is now the _atom_ # ) as its argument, yielding @(#). If seems that what Richard is saying is that this issue has been resolved de-facto (which is fine with me), but the ambiguity remains. I haven't thought of any 'collateral' consequences of this, but maybe there aren't any? Mike brady@cs.tcd.ie