Commit Graph

25 Commits

Author SHA1 Message Date
Fergus Henderson
ea9c17ee54 Include the library .m files in the tags file.
compiler/Mmake:
	Include the library .m files in the tags file.

hlds.m and lots of other places:
	Change the type of the argument list of a HLDS `call' from
	`list(term)' to `list(var)'.
1995-06-06 01:22:10 +00:00
Zoltan Somogyi
0f46c5d4e7 Merged in changes from the pass_str_branch. 1995-05-06 07:29:58 +00:00
Fergus Henderson
ac4f8ba0fb Add copyright messages.
compiler/*:
	Add copyright messages.
	Change all occurences of *.nl in comments to *.m.

compiler/mercury_compile.pp:
	Change the output to the .dep files to use *.m rather than *.nl.
	(NOTE: this means that `mmake' will not work any more if you
	call your files *.nl!!!)
1995-03-30 21:03:41 +00:00
Fergus Henderson
77b16b11d9 Implement floating point.
code_util.nl, float.nl, llds.nl, mercury_builtin.nl, opt_debug.nl,
parser.nl, polymorphism.nl, sp_lib.nl, string.nl, string.nu.nl,
type_util.nl, typecheck.nl, unify_gen.nl:
	Implement floating point.

Makefile.common:
	Remove `-include test.dep' line.  Use Mmake.

int.nl:
	Update a few of the comments.

io.nu.nl:
	For Sicstus Prolog, if main/2 is not defined then enter the
	debugger.
1995-03-15 14:28:24 +00:00
Thomas Conway
1970069136 reimplement remove_dups so that it works for unsorted lists.
list.nl:
	reimplement remove_dups so that it works for unsorted lists.
	XXX the call in sort should be to a specialized version since
	for unsorted lists the current implementation is O(NlogN).

polymorphism.nl:
	Fix the places where it was sorting a list of variables to
	remove duplicates. Now it just removes duplicates without
	sorting. This means that polymorphism works irrespective
	of the given set of variable numbers. :-)
	( fjh says 'd'oh' at this stage )
1995-02-09 07:59:51 +00:00
Fergus Henderson
56c4d2cbc4 The fields in a `type_info' structure should be just
code_info.nl hlds.nl hlds_out.nl io.nl llds.int llds.nl opt_debug.nl
polymorphism.nl shapes.nl switch_gen.nl unify_gen.nl:
	The fields in a `type_info' structure should be just
	procedure addresses, not closures.
1995-02-08 19:09:41 +00:00
Fergus Henderson
559d7f1531 Change the definition of the type_info functor in mercury_builtin
polymorphism.nl, mercury_builtin.nl:
	Change the definition of the type_info functor in mercury_builtin
	from type_info/1 to type_info/0, so that it gets the right sort
	of tag.
1995-02-07 12:43:04 +00:00
Fergus Henderson
a452ccb946 Fix the "Unknown builtin call" bug that Tom introduced.
polymorphism.nl:
	Fix the "Unknown builtin call" bug that Tom introduced.
1995-02-07 09:21:18 +00:00
Fergus Henderson
f862db3245 Lots of changes to implement compare/3.
*.nl:
	Lots of changes to implement compare/3.
1995-02-07 07:48:28 +00:00
Thomas Conway
b759b4436a change occurences of is_builtin and not_builtin to abstract
various:
	change occurences of is_builtin and not_builtin to abstract
	calls.

code_info.nl:
	perform transitive checking for variable dependencies.
1995-02-07 07:39:13 +00:00
Fergus Henderson
62fa8be865 Add new targets `mercury_compile.sicstus' (the Mercury compiler
Makefile.common:
	Add new targets `mercury_compile.sicstus' (the Mercury compiler
	compiled with Sicstus) and `mercury_compile.sicstus.debug'
	(debugging version of the above).

*.nl:
	Use Sicstus-compatible char and string escapes.
	Avoid the use of explicit existential quantification.
	Various other hacks to get things to parse correctly under Sicstus.

prog_io.nl:
	Don't allow (A -> B) in DCGs, since NU-Prolog and Mercury give
	it different semantics to Sicstus.

sp_builtin.nl, sp_lib.nl:
	Split sp_builtin.nl into sp_builtin.nl and sp_lib.nl.

sp_conv.sed:
	Add sed script which converts some character escapes so that
	they work with Sicstus.

term_io.nl:
	Remove term_io__prefix_op etc. since they aren't used anymore.
1995-01-31 06:00:16 +00:00
Fergus Henderson
cf32ee116f Fix bug in the generation of goal_info non-local variables
polymorphism.nl:
	Fix bug in the generation of goal_info non-local variables
	which was causing `variable number <n> not in register or stack'.
1995-01-27 06:12:48 +00:00
Fergus Henderson
865beeb3ca Various minor bugfixes.
Makefile.common:
	Various minor bugfixes.

Makefile.mercury:
	Add rules for creating assembler (.s) files.

term.nl, *.nl:
	Replace term__context_init/1 with term__context_init/0.
	The first argument was always zero anyway.

io.nl:
	Change the interface to io__read_char and io__read_line so that
	they return a better error indicator.
	Add a new predicate io__putback_char.

polymorphism.nl:
	Don't abort if a predicate doesn't have any modes.

options.nl:
	Let's try turning polymorphism on again.  It seems to work this time.

string.nl, string.nu.nl:
	Add string__to_float.
	Move implementation of string__to_int from string.nl to string.nu.nl.
1995-01-23 17:07:17 +00:00
Fergus Henderson
280479f7ee Fix bug in make_proc_label: for unification predicates,
code_util.nl:
	Fix bug in make_proc_label: for unification predicates,
	look at the _last_ argument to determine the type for
	name mangling, not the first, since we introduce extra
	higher-order arguments at the start.

make_hlds.nl, hlds.nl:
	Ensure that the proc_info head_vars has the right length even for
	imported predicates.  This fixes a problem with --polymorphism.

make_hlds, unify_proc.nl, prog_util.nl:
	Output unification procedures for equivalence types.

polymorphism.nl:
	Ensure that this works even for unification procedures for
	equivalence types, which are a bit wierd since they are not
	quite type correct.

typecheck.nl:
	Don't attempt to typecheck unification predicates, since
	they are already type-correct when we construct them.
	In particular don't typecheck unification procedures for
	equivalence types, since it would report a spurious error.

mercury_to_mercury.nl:
	Remove a superfluous duplicate clause.
1995-01-20 10:02:03 +00:00
Fergus Henderson
65ac02d56e Add some targets for compiling the compiler and the library.
Makefile.common:
	Add some targets for compiling the compiler and the library.

type_util.nl, dense_switch.nl, switch_gen.nl, polymorphism.nl:
	Rename inttype, chartype, etc. as int_type, char_type, etc.
	Add polymorphic_type.

modes.nl, mode_errors.nl:
	Report an error for direct attempts to unify higher-order pred types.
	(Of course, we don't catch indirect attempts via polymorphic types -
	that would require global analysis.  For them, we report the error
	at runtime.)

modes.nl:
	Remove unreachable code from conjuctions.
	(XXX also should do this for if-then-else.)

options.nl:
	Turn -p off by default.  I'll turn it on again when it works ;-)
1995-01-19 16:09:44 +00:00
Fergus Henderson
5b0ed0fd4d Generate sensible code in the case were we take the address
polymorphism.nl, mercury_builtin.nl:
	Generate sensible code in the case were we take the address
	of the unification predicate for a builtin or enumeration type.
1995-01-18 13:15:21 +00:00
Fergus Henderson
8c6192daba Create a new cons_id `pred_const(pred_id, proc_id)',
hlds.nl code_info.nl hlds.int hlds_out.nl polymorphism.nl:
	Create a new cons_id `pred_const(pred_id, proc_id)',
	to avoid ambiguities with the old use of
	`cons_id(name, arity)'.
1995-01-18 04:26:45 +00:00
Fergus Henderson
1032e2a841 Change things so that only call/1 is builtin.
code_util.nl, polymorphism.nl, mercury_builtin.nl:
	Change things so that only call/1 is builtin.
	For call/N, we can implement them by hand in mercury_builtin.nl.
	(Procedure call overhead is the least of our worries right now.)

	Note that call/N still only works in the following mode.
		:- call (in, in, ..., in) is semidet.
	You can't use it to call det predicates.
1995-01-17 22:42:07 +00:00
Fergus Henderson
1c2152a578 Some minor changes to the comments.
live_vars.nl, polymorphism.nl:
	Some minor changes to the comments.
1995-01-17 10:52:46 +00:00
Fergus Henderson
10ad647d76 Handle polymorphic unifications (finally!)
polymorphism.nl:
	Handle polymorphic unifications (finally!)
	Give some of the introduced variables meaningful names.
	Don't insert additional arguments for polymorphic builtins
	(currently the only polymorphic builtin is call/N.)
1995-01-16 15:10:51 +00:00
Fergus Henderson
55db360370 Store two typevarsets in the pred_info rather than just one.
polymorphism.nl, hlds.nl, typecheck.nl:
	Store two typevarsets in the pred_info rather than just one.
	The first one holds the typevarset for the arguments only,
	the second also includes any local type variables occuring
	in the bodies of any of the procedures for that predicate.
	This solves a performance problem with polymorphism.nl.
1995-01-16 07:54:50 +00:00
Fergus Henderson
cc0195fef5 Make sure that if we introduce any extra head variables,
polymorphism.nl:
	Make sure that if we introduce any extra head variables,
	we fix up the quantification information in the goal_info.
1995-01-14 18:41:47 +00:00
Fergus Henderson
48e3dea925 Fix some bugs:
polymorphism.nl:
	Fix some bugs:
		- I had forgotten to update the argmodes of the modified
		  procedures
		- I was updating the argtypes and attempting to use there
		  old value.  I fixed this by splitting the algorithm
		  into two passes.
		- to compute the types of the arguments to a call,
		  apply the type mapping from the _caller_ not the callee.
	Also improve efficiency in a couple of places.

hlds.nl:
	Add some new access predicates required by polymorphism.nl.

list.nl:
	Add a new predicate list__duplicate, which is used by polymorphism.nl.

typecheck.nl, type_util.nl:
	Move the type_unify routines from typecheck.nl into type_util.nl,
	since they're also needed by polymorphism.nl.

term.nl:
	Export term__apply_rec_substitution_to_list, since it's needed
	by polymorphism.nl.

- - - - - - - - - - - - - - - - - - - - - - - - -

mode_util.nl, type_util.nl:
	Move some routines from mode_util.nl to type_util.nl, where they
	really belong.

- - - - - - - - - - - - - - - - - - - - - - - - -

make_hlds.nl, code_util.nl, typecheck.nl:
	Mark builtin predicates as "external" in make_hlds.nl,
	rather than checking for them as a special case in typecheck.nl.

- - - - - - - - - - - - - - - - - - - - - - - - -

prog_io.nl, hlds.nl, typecheck.nl:
	For documentation purposes, define equivalent types `tvar',
	`tvarset', `tsubst' for type variables, type varsets, and
	type substitutions.

- - - - - - - - - - - - - - - - - - - - - - - - -

mercury_compile.pp, options.nl:
	Change the handling of the --dump-hlds option so that you can
	now dump the HLDS after any of the 12 HLDS transformation passes.

- - - - - - - - - - - - - - - - - - - - - - - - -

make_hlds.nl:
	Report an error if there are clauses for an imported predicate.

- - - - - - - - - - - - - - - - - - - - - - - - -

io.nu.nl:
	Add a new predicate r/1 which is like run/1 except that
	you pass it a string rather than a list of atoms.
	So now you can do
		$ mercury_compile.debug
		Mercury Interpreter 0.1
		NU-Prolog 1.6.4
		1?- r("mc -options blah blah blah").
1995-01-14 11:59:51 +00:00
Fergus Henderson
a5c3573b24 It actually compiles now.
polymorphism.nl:
	It actually compiles now.
	Who knows, it might even work :-)
	I doubt it though.
1995-01-12 09:50:40 +00:00
Fergus Henderson
10aacc5f51 New module which does a syntactic tranformation of the HLDS
polymorphism.nl:
	New module which does a syntactic tranformation of the HLDS
	to implement polymorphic unifications by passing higher-order
	unification predicates.

	Still very unfinished (lots of syntax errors, etc. :-).
1995-01-11 18:08:00 +00:00