Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ub4b!kulcs!kulcs.cs.kuleuven.ac.be!bimbart From: bimbart@kulcs.cs.kuleuven.ac.be (Bart Demoen) Newsgroups: comp.lang.prolog Subject: Re: Does Prolog have an unambiguous syntax definition? Message-ID: <1945@n-kulcs.cs.kuleuven.ac.be> Date: 14 Feb 91 07:52:52 GMT Sender: news@cs.kuleuven.ac.be Organization: Dept. of Computer Science (K.U.Leuven) Lines: 34 Originator: bimbart@kulcs.cs.kuleuven.ac.be I send the following on behalf of Roger Scowen. ------------------------------------------ Kjell (University of California, Santa Cruz) asks: > Is there a document that describes the reader's behaviour when it > sees an ambiguous term? Here's an example to show what I mean: > > :- op(300,fx,#). % prefix > :- op(500,xf,#). % postfix > :- op(400,fx,@). % prefix > > display(@ #). > > Will Prolog display @(#) or #(@), and why is one preferred over the other? Syntactic ambiguities in Prolog have been considered by the ISO Prolog standardization group. Different Prolog systems give different results, so there is no right answer. The latest draft (SC22 WG17 N70) forbids all ambiguous cases from occurring in a standard-conforming program. There are several restrictions, for example the case you have quoted is not allowed because the draft states (in 6.3.1.3): "an atom which is an operator shall not be the immediate operand of an operator". Roger Scowen, SC22 WG17 (Prolog) Convener, DITC/93, National Physical Laboratory, Teddington, Middlesex, England TW11 0LW 13 February 1991 Tel (Abroad): +44 81 943 6956 Fax (Abroad): +44 81 977 7091 Email: rss@seg.npl.co.uk Telex: 262344