[net.lang.prolog] lint for prolog

masrani@calgary.UUCP (Roy Masrani) (11/26/85)

I am working on a "lint" program that will point out potential errors in
(c-)prolog code.  Some obvious ones are:

   -- variables used only once in a clause (possibly a spelling mistake).
   -- calls that will never succeed (number/type of arguments, undefined
clauses)
   -- system calls used inappropriately
   -- clauses defined in more than one file
	
Has anyone already done this?  Anyone have any ideas or other types of
errors that should be caught?  Please post or email replies.  Thanks.

-----------------
Roy Masrani, Department of Computer Science, University of Calgary 
2500 University Drive NW, Calgary, Alberta, CANADA T2N 1N4; (403) 220 3531
..!{ubc-vision,ihnp4}!alberta!calgary!masrani

michaelm@bcsaic.UUCP (michael b maxwell) (11/28/85)

How about circular definitions? e.g.:
	sister (X, Y) :- female (X), ...
	:
	:
	female (X) :- sister (X,_).
(Comment: I would imagine that one can reliably catch this in the simple 
sort of case I illustrated above, but I would doubt that one could always
catch it--e.g. if the cirularity is nested, so to speak.)

And as an option (to be turned on by a flag), definitions of rules
for a given predicate before facts.  This *may* be what you want, but in
my limited experience, 99 times out of 100 it isn't.
-- 
Mike Maxwell
Boeing Artificial Intelligence Center
	...uw-beaver!uw-june!bcsaic!michaelm