Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!zombie.ncsc.mil!blackbird.afit.af.mil!news.engr.udayton.edu!news.cps.udayton.edu!news.ysu.edu!news.ecn.uoknor.edu!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
From: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Subject: Prolog syntax
Message-ID: <9511221.23905@mulga.cs.mu.OZ.AU>
Sender: news@cs.mu.OZ.AU (CS-Usenet)
Organization: Computer Science, University of Melbourne, Australia
Date: Sat, 22 Apr 1995 11:58:15 GMT
Lines: 42

Should the following be syntax errors?

	?- display(* + *).		% 1

	?- display(1 '+' 2).		% 2

	?- display(X = *).		% 3

	?- display(X = '*').		% 4

Personally, I think 1, 2, and 3 should be syntax errors.
According to my reading of the draft ISO Prolog standard,
1, 3, and 4 are supposed to be syntax errors.
But according to the four Prolog implementations I have on hand
(NU-Prolog, SICStus Prolog, SWI-Prolog, and Aquarius Prolog),
none of them are syntax errors!

Allowing gobbledegook like example 1 makes it difficult to
produce good error messages, since for common errors such as

	( X = 0 ->
		foo,
		bar,	% oops, extra comma
	;
		baz
	).

the first incorrect token is not the extraneous comma or even the semicolon,
it is at `baz', two lines past the actual cause of the error.

Originally Mercury syntax was going to be based on ISO Prolog syntax,
since I had a clear specification of ISO Prolog syntax and I didn't
seen any need to avoid reinventing the wheel.  But it seems that
ISO Prolog syntax and "defacto standard Prolog syntax" disagree anyway,
and neither of them is much good.

Opinions?

-- 
Fergus Henderson            | Tell you what: go write a 100x100 matrix multiply
fjh@cs.mu.oz.au             | of integers in both languages and then let's talk
http://www.cs.mu.oz.au/~fjh | about speed, ok? - Tom Christiansen.
