mattias@sylvester.csd.uu.se (Mattias Waldau) (03/01/91)
To: lakshman@n.cs.uiuc.edu (T.K. Lakshman)
In-reply-to: lakshman@n.cs.uiuc.edu's message of 25 Feb 91 18:08:37 GMT
Subject: A Type checking/reconstruction procedure for Typed-Prolog
BCC: mattias
--text follows this line--
I like the type checker very much, it works fine under sicstus 0.7,
except that in the typechecker tries to redefine numbervars (are there
actually DEC-10 like prologs without numbervars?).
Thanks for posting a nice program!
/mattias
Two warnings to other users:
1) the program cannot handle disjunctions (anoying, but simple to fix,
just expand the disjunction to a set of clauses)
2) the program cannot distinguish between different predicates with
the same functor but different arity, e.g. foo/3 and foo/5. Rename
foo/5 to foo_aux/5.
Two suggestions/questions to the authors:
1) please redefine rload, so that it accepts a list of files, and
rewrite libdecls to fit your format (i.e. remove :- from the file).
then we can typecheck a set set of files, first loading libdecls, by
writing [libdelcs, file1, file2]. It doesn't bother me if all output
is put in the same file.
2) Funny (erroneous) behaviour:
the program
type bar --> a ; b.
type foo --> b ; c.
p(b).
results in
% Type Constructors :
type bar(0).
type foo(0).
% Types for Functions :
type a: [] --> bar.
type b: [] --> bar.
type b: [] --> foo.
type c: [] --> foo.
% Types for Predicates :
pred p(bar).
% Program :
p(b).
but the program
type bar --> a ; b.
type foo --> b ; c.
p(b).
p(c).
results in an error
...Reading declarations and program clauses
... doing Type Checking / Reconstruction
@#$%^&>> Type Conflict in types fun([],foo) and fun(_2470,bar)
{ Execution aborted }
| ?-
What behaviour is correct, both since the type declaration is
incorrect. The constant "b" occurs in several types.
--
Mattias Waldau
Computing Science Department mattias@emil.csd.uu.se
P.O. Box 520, S-751 20 Uppsala, Sweden Phone: +46-18-181055
lakshman@n.cs.uiuc.edu (T.K. Lakshman) (03/03/91)
In article <MATTIAS.91Mar1070321@sylvester.csd.uu.se> you write: >To: lakshman@n.cs.uiuc.edu (T.K. Lakshman) >In-reply-to: lakshman@n.cs.uiuc.edu's message of 25 Feb 91 18:08:37 GMT >Subject: A Type checking/reconstruction procedure for Typed-Prolog >BCC: mattias --text follows this line-- <STUFF DELETED> Thanks the suggestions. I've incorporated the suggested changes. The modified file Types.tar.Z is (as before) available by anonymous ftp from a.cs.uiuc.edu. > >2) Funny (erroneous) behaviour: A check for overloaded symbols was omitted from the type-checking/reconstruction procedure. It has now been incorporated. We appreciate your comments. regards, tk -- INTERNET : lakshman@cs.uiuc.edu OFFICE : 217-244-5973 MAIL : Dept. of C.S., DCL, 1304 W Springfield Ave, Urbana, Il 61801.