Commit Graph

35 Commits

Author SHA1 Message Date
Fergus Henderson
04b720630b Update the copyright messages so that (a) they contain the correct years
and (b) they say "Copyright (C) ... _The_ University of Melbourne".
1997-07-27 15:09:59 +00:00
Andrew Bromage
9b7f11c6dd Reorganisation of modules to do with the inst data type.
Estimated hours taken: 20

Reorganisation of modules to do with the inst data type.

This is actually the first installment of the alias tracking mode
checker in disguise.  A very good disguise.  The rationale for
this reorganisation is to reduce coupling in the part of the mode
checker which is _not_ in this change (ie most of it).

Alias tracking requires a new kind of inst, alias(inst_key), where
an inst_key is a handle on some other sub-inst.  With it goes a
data structure in which to store dereferenced insts and all the
operations which go with it.  This code will go in the new module
inst.m so that it doesn't have to go in prog_data.m.  (I briefly
considered putting it in instmap.m however this introduces some
bad coupling since instmap.m imports hlds_module.m.  Putting it
in prog_data.m would cause hlds_*.m to depend on prog_data.m,
but we have designed things so that the dependencies go in the
other direction.)

The remainder of the reorganisation is a general cleanup: the
inst testing predicates (inst_is_*) have been moved out of
mode_util because they are not actually operations on modes at
all, and have been moved into inst_match.  inst_match has then
been split because otherwise it would be 2000 lines long and
will get significantly bigger when aliasing is added.  Roughly
speaking, any operations which create new insts from old ones
have been moved into a new module, inst_util while any operations
which test the values of insts remain in inst_match.

Also included are the removal of some NU-Prologisms since the
NU-Prolog version of the compiler is no longer supported.  Two
changes here:

	- Removal of some when declarations.
	- A gross hack in inst_is_*_2, where two copies of
	  the same inst were passed into the predicate so that
	  one could be switched on.  Thank NU-Prolog's lack of
	  common subexpression elimination.

compiler/inst.m:
	New module which contains the data types inst, uniqueness,
	pred_inst_info, bound_inst.

compiler/inst_util.m:
	New module which contains predicates which perform mode
	checking-like operations on insts.

	Moved in:
		abstractly_unify_inst, abstractly_unify_inst_functor,
		inst_merge, make_mostly_uniq_inst (from inst_match.m)

compiler/inst_match.m:
	Moved out:
		inst_merge, make_mostly_uniq_inst,
		abstractly_unify_inst, abstractly_unify_inst_functor
			(to inst_util.m)

	Moved in:
		inst_is_*, inst_list_is_*, bound_inst_list_is_*
			(from mode_util.m)

	Now exported:
		unique_matches_initial/2, unique_matches_final/2
		inst_contains_instname/3, pred_inst_matches/3
		(They are required by inst_util.m, and they are
		useful in their own right.)

compiler/instmap.m:
	instmap_delta_lookup_var/3 reincarnated as
	instmap_delta_search_var/3.  The reason for this change is
	that previously, instmap_delta_lookup_var simply returned
	`free' if the searched-for var did not occur in the
	instmap_delta.  This is somewhat non-obvious behaviour.
	instmap_delta_search_var/3 fails in such a situation.

compiler/mode_util.m:
	Moved out:
		inst_is_*, inst_list_is_*, bound_inst_list_is_*
			(to inst_match.m)
		(These are not really operations on modes.)

compiler/modecheck_call.m:
	Moved in modecheck_higher_order_func_call/5, from modecheck_unify.m

compiler/modecheck_unify.m:
	Moved out modecheck_higher_order_func_call/5, to modecheck_call.m
	where it should have been all along.

compiler/prog_data.m:
	Moved out the types inst, uniqueness, pred_inst_info,
	bound_inst (to inst.m).

compiler/common.m:
compiler/cse_detection.m:
compiler/fact_table.m:
compiler/higher_order.m:
compiler/hlds_data.m:
compiler/hlds_goal.m:
compiler/hlds_out.m:
compiler/intermod.m:
compiler/liveness.m:
compiler/llds.m:
compiler/make_hlds.m:
compiler/mercury_to_mercury.m:
compiler/mode_debug.m:
compiler/mode_errors.m:
compiler/mode_info.m:
compiler/modes.m:
compiler/module_qual.m:
compiler/polymorphism.m:
compiler/prog_io.m:
compiler/prog_io_util.m:
compiler/prog_util.m:
compiler/simplify.m:
compiler/switch_detection.m:
compiler/unify_proc.m:
compiler/unique_modes.m:
	Miscellaneous minor changes to cope with the above changes.

compiler/notes/compiler_design.html:
	Document the new modules.
1997-07-24 01:27:21 +00:00
Zoltan Somogyi
a15c032df7 Flesh out the code already here for traversing module_infos,
Estimated hours taken: 4

passes_aux:
	Flesh out the code already here for traversing module_infos,
	making it suitable to handle all the passes of the back end.

mercury_compile:
	Use the traversal code in passes_aux to invoke the back end passes
	over each procvedure in turn. Print a one-line message for each
	predicate if -v is given (this fixes a long-standing bug).

excess.m, follow_code.m, follow_vars.m, live_vars.m, lveness.m, store_alloc.m:
	Remove the code to traverse module_infos, since it is now unnecessary.

export.m:
	Remove an unused argument from export__produce_header_file_2.

others:
	Move imports from interfaces to implementations, or in some cases
	remove them altogether.
1996-08-03 12:06:26 +00:00
Fergus Henderson
66c9b90738 Split the expansion of equivlance types from prog_util.m
Estimated hours taken: 0.75

prog_util.m, equiv_type.m:
	Split the expansion of equivlance types from prog_util.m
	into a new file equiv_type.m.  Use slightly clearer predicate
	names, starting with equiv_type__ rather than prog_util__ of course.

mercury_compile.pp, mercury_to_goedel.m:
	Changed to use equiv_type rather than prog_util.

mercury_to_goedel.m:
	Move some import_module declarations from the interface to
	the implementation section, since they weren't needed by the
	interface.
1996-07-03 15:47:06 +00:00
Fergus Henderson
52929b12e0 Recommit my earlier (buggy) change to avoid looping during the
Estimated hours taken: 1

compiler/prog_util.m:
	Recommit my earlier (buggy) change to avoid looping during the
	expansion of equivalence types for `:- type foo == bar(foo)',
	with the bug fixed this time.
	(The bug was that I was passing down the wrong set of type ids
	when processing the arguments - since we process things bottom-up,
	the current type-id has not yet been expanded when processing the
	arguments, and it shouldn't be included in the set at that point.)
1996-07-03 14:49:27 +00:00
Fergus Henderson
f0db37abbd Back out my previous change to avoid looping for
Estimated hours taken: 0.5

compiler/prog_util.m:
	Back out my previous change to avoid looping for
	`:- type foo == bar(foo)', since my change was buggy ---
	it meant that we failed to expand some equivalence types
	that we should have.
1996-07-03 12:52:47 +00:00
Fergus Henderson
7109800147 Fix a bug in the expansion of equivalence types:
Estimated hours taken: 2

compiler/prog_util.m:
	Fix a bug in the expansion of equivalence types:
	the loop detection code was not quite right, and
	so it looped for `:- type foo == bar(foo)'.
1996-07-02 17:00:42 +00:00
Simon Taylor
5d9e4158f7 Module qualification of types, insts and modes.
Estimated hours taken: 45

Module qualification of types, insts and modes.

Added a new interface file - <module>.int3. This contains the
short interface qualified as much as possible given the information
in the current module.

When producing the .int and .int2 files for a module, the compiler uses
the information in the .int3 files of modules imported in the interface
to fully module qualify all items. The .int2 file is just a fully
qualified version of the .int3 file. The .int3 file cannot be overwritten
by the fully qualified version in the .int2 file because then mmake would
not be able to tell when the interface files that depend on that .int3
file really need updating.

The --warn-interface-imports option can be used to check whether
a module imported in the interface really needs to be imported in
the interface.


compiler/module_qual.m
Module qualify all types, insts and modes. Also checks for modules
imported in the interface of a module that do not need to be.

compiler/modules.m
The .int file for a module now depends on the .int3 files of imported
modules. Added code to generate the make rule for the .int file in the
.d file. There is now a file .date2 which records the last time the
.int2 file was updated.
The .int3 files are made using the --make-short-interface option
introduced a few weeks ago.

compiler/options.m
Added option --warn-interface-imports to enable warning about interface
imports which need not be in the interface. This is off by default
because a lot of modules in the library import list.m when they only
need the type list, which is defined in mercury_builtin.m.
Removed option --builtin-module, since the mercury_builtin name is wired
into the compiler in a large number of places.

compiler/prog_util.m
Added a predicates construct_qualified_term/3 and construct_qualfied_term/4
which take a sym_name, a list of argument term and a context for the /4
version and give a :/2 term.

compiler/type_util.m
Modified type_to_type_id to handle qualified types. Also added predicates
construct_type/3 and construct_type/4 which take a sym_name and a list of
types and return a type by calling prog_util:construct_qualified_term.

compiler/modes.m
On the first iteration of mode analysis, module qualify the modes of
lambda expressions.

compiler/mode_info.m
Added field to mode_info used to decide whether or not to module qualify
lambda expressions.

compiler/mode_errors.m
Added dummy mode error for when module qualification fails so that mode
analysis will stop.
Added code to strip mercury_builtin qualifiers from error messages to
improve readability.

compiler/typecheck.m
Strip builtin qualifiers from error messages.

compiler/llds.m
compiler/llds_out.m
compiler/opt_util.m
compiler/opt_debug.m
Change the format of labels produced for the predicates to use the
qualified version of the type name.

compiler/mercury_compile.pp
Call module_qual__module_qualify_items and make_short_interface.
Remove references to undef_modes.m and undef_types.m

compiler/undef_modes.m
compiler/undef_types.m
Removed, since their functionality is now in module_qual.m.

compiler/prog_io.m
Changed to qualify the subjects of type, mode and inst declarations.

compiler/*.m
Changes to stop various parts of the compiler from throwing away
module qualifiers.
Qualified various mercury_builtin builtins, e.g. in, out, term etc.
where they are wired in to the compiler.

compiler/hlds_data.m
The mode_table and user_inst_table are now abstract types each
storing the {mode | inst}_id to hlds__{mode | inst}_defn maps
and a list of mode_ids or inst_ids. This was done to improve the
efficiency of module qualifying the modes of lambda expressions
during mode analysis.
module_info_optimize/2 now sorts the lists of ids.
The hlds_module interface to the mode and inst tables has not changed.

compiler/hlds_module.m
Added yet another predicate to search the predicate table.
predicate_table_search_pf_sym_arity searches for predicates or
functions matching the given sym_name, arity and pred_or_func.

compiler/higher_order.m
Changed calls to solutions/2 to list__filter/3. Eliminated unnecessary
requantification of goals.

compiler/unused_args.m
Improved abstraction slightly.
1996-06-11 06:30:10 +00:00
Zoltan Somogyi
c588526f03 Add a predicate to rename variables in the kinds of goals we have in
Estimated hours taken: 1

prog_util:
	Add a predicate to rename variables in the kinds of goals we have in
	items. (We already have similar predicates for terms and for
	hlds_goals).

prog_io:
	We used to expand ( p ; q ) in DCG clauses to become
	( p(DCG1, DCG2) ; q(DCG1, DCG3), DCG2 = DCG3 ). These extra
	unifications can pile up rather badly; in the new version of lexer.m,
	two 128-way switches each ended up with 90 unifications in the last
	arm. This is very bad for performance. Instead of adding unifications
	to make sure that both arms of a disjunction put the final stream value
	in the same variable, we now use renaming when possible.
1996-05-27 23:33:51 +00:00
Fergus Henderson
f89d46df5e Fix a bug (caused by a cut-and-paste variable numbering error) in
Estimated hours taken: 0.5

compiler/prog_util.m:
	Fix a bug (caused by a cut-and-paste variable numbering error) in
	the expansion of equivalence types in `:- func' declarations.
	(Thanks to Tyson for the bug report.)
1996-05-25 02:18:07 +00:00
Fergus Henderson
4133ba3cf3 Change the expansion of equivalence types to use an O(N log N)
Estimated hours taken: 4

prog_util.m:
	Change the expansion of equivalence types to use an O(N log N)
	algorithm rather than an O(N * N) one.  This change cuts
	the compilation time for live_vars.m (a bad case as far as
	equivalence types are concerned, since it imports so many
	modules) by more than 15%.
1996-05-14 19:45:09 +00:00
Zoltan Somogyi
649b6908c3 Rename branch_delay_slot to have_delay_slot.
Estimated hours taken: 8

options.m:
	Rename branch_delay_slot to have_delay_slot.
	Set optimize_delay_slot in -O2 only if have_delay_slot was set earlier.
	This is possible now because the default optimization level is now
	set in mc.

mercury_compile:
	Change verbose output a bit to be more consistent.

dead_proc_elim:
	Export the predicates that will eventually be needed by inlining.m.

inlining.m:
	Use the information about the number of times each procedure is called
	to inline local nonrecursive procedures that are called exactly once.
	EXCEPT that this is turned off at the moment, since the inlining of
	parse_dcg_goal_2 in prog_io, which this change enables, causes the
	compiler to emit incorrect code.

prog_io:
	Moved the data type definitions to prog_data. (Even though prog_io.m
	is ten times the size of prog_data.m, the sizes of the .c files are
	not too dissimilar.)
1996-04-24 01:00:23 +00:00
Fergus Henderson
f839ec8f78 Expand eqivalence types in `:- func' declarations.
Estimated hours taken: 0.25

compiler/prog_util.m:
	Expand eqivalence types in `:- func' declarations.
1996-04-05 11:44:24 +00:00
Fergus Henderson
3b36da6e77 Implement functional syntax. You can now use `:- func' in a similar manner
Estimated hours taken: 12

Implement functional syntax.  You can now use `:- func' in a similar manner
to `:- pred'.  For example, `:- func foo(int, int) = int.' declares a function,
and `:- mode foo(in, in) = out.' defines a mode for it.  You can write clauses
for functions, such as `foo(X, Y) = Z :- Z is 2*X + Y.'  Any term in the
head or body of a clause can be a function call, e.g. `bar(X, Y, foo(X, Y))'.

Until we have implemented a proper Mercury debugger, this syntax
should not be used (except that I might reimplement the functions
provided by Prolog's is/2 predicate using this syntax, rather than
the current special-case hack in the parser).

prog_io.m:
	Add syntax for declaring and defining functions.
	Disallow the use of `=' to define modes, as in `:- mode foo = bar.'
	(Instead, you should use `::'.  `==' is also allowed.)
	Also, use higher-order predicates to simplify some of the rather
	repetitious parsing code.

mercury_to_mercury.m, mercury_to_goedel.m, make_hlds.m, modules.m:
	Handle new functional syntax.

typecheck.m:
	Add support for functions, function types such as `func(int) = int',
	and currying.  (But there's currently no equivalent to call/N for
	functions, so function types and currying aren't very useful yet.)

undef_types.m:
	Add support for function types.

modes.m:
	Convert function calls into predicate calls.
	(This must be done after typechecking is complete,
	so I put it in mode analysis.)

hlds.m:
	Add new field `pred_or_func' to the pred_info.

hlds_out.m:
	Print out the `pred_or_func' field.

higher_order.m, unused_args.m, lambda.m, dnf.m:
	Pass extra pred_or_func argument to pred_info_init to specify that
	the thing being created is a predicate, not a function.

constraint.m, dependency_graph.m, hlds_out.m:
	`mercury_output_mode_subdecl' has been renamed
	`mercury_output_pred_mode_subdecl'.

prog_util.m:
	Add new predicate split_type_and_mode/3.

llds.m:
	Print out
		/* code for predicate '*'/3 in mode 0 */
	rather than
		/* code for predicate */3 in mode 0 */
	to avoid a syntax error in the generated C code.
1996-03-25 07:41:54 +00:00
Fergus Henderson
6d7f4b9b30 Undo dylan's changes in the names of some library entities,
Estimated hours taken: 1.5

Undo dylan's changes in the names of some library entities,
by applying the following sed script

	s/term_atom/term__atom/g
	s/term_string/term__string/g
	s/term_integer/term__integer/g
	s/term_float/term__float/g
	s/term_context/term__context/g
	s/term_functor/term__functor/g
	s/term_variable/term__variable/g
	s/_term__/_term_/g
	s/std_util__bool_/bool__/g

to all the `.m' and `.pp' files in the compiler and library directories.
The reason for undoing these changes was to minimize incompatibilities
with 0.4 (and besides, the changes were not a really good idea in the first
place).

I also moved `bool' to a separate module.
The main reason for that change is to ensure that the `__' prefix is
only used when it genuinely represents a module qualifier.
(That's what dylan's changes were trying to acheive, but `term__'
does genuinely represent a module qualifier.)

compiler/*.m:
	Apply sed script above;
	where appropriate, add `bool' to the list of imported modules.
1996-02-03 17:30:14 +00:00
Dylan Shuttleworth
3ab8d92226 Change names with badly placed double underscores (ie where the part of
Estimated hours taken: _2___

Change names with badly placed double underscores (ie where the part of
a name before a double underscore is not the same as the module name.)

Reflect changes in the library interface.

compiler/*:
	Use the newer, more correct form of the term and bool names.
	Predicates "bool__" are now "std_util__bool" and labels of
	the term ADT are now "term_" instead of "term__".

compiler/vn*.m:
	change all names "vn__*" to a correct module prefix.  All the
	names remain qualified.

compiler/hlds.m:
	s/\<is_builtin__/hlds__is_builtin_/g
	s/\<dependency_info__/hlds__dependency_info_/g

compiler/unify_proc.m:
	s/\<unify_proc_info__/unify_proc__info_/g

compiler/transform.m:
	s/\<reschedule__conj/transform__reschedule_conj/g
1995-12-29 03:45:20 +00:00
Zoltan Somogyi
bebe96be34 Look inside blocks introduced by value numbering when looking
frameopt:
	Look inside blocks introduced by value numbering when looking
	restorations of succip.

value_number, opt_util:
	If we are using conservative garbage collection, disable value
	numbering for blocks that allocate more than one cell on the heap.
	This allows value numbering of most blocks to work in the absence
	of -DALL_INTERIOR_POINTERS.

all other source files:
	Clean up "blank" lines that nevertheless contain space or tab
	characters.
1995-08-27 11:10:20 +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
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
c074b02970 In term__create_var, use bit reversals rather than random numbers
term.nl:
	In term__create_var, use bit reversals rather than random numbers
	to ensure that the binary trees remain balanced.

call_gen.nl:
	For polymorphic unifications, generate a call to fatal_error().

code_gen.nl, hlds.nl, make_hlds.nl, modes.nl, unify_proc.nl:
	Move the unify_request data structure from code_info to the HLDS,
	and move the unify_request handling from code_gen.nl to modes.nl.
	This is because we now generate HLDS code rather than LLDS code
	for complicated unifications.

code_util.nl, hlds_out.nl:
	Do some special name mangling for =/2.

float.nl, typecheck.nl, undef_types.nl, term.nl, hlds.nl:
	Until we implement `float' properly, define it as an abstract type
	in float.nl.

hlds.nl, make_hlds.nl:
	Rename `local_pred, imported_pred, exported_pred' to just
	`local, imported, exported' since they also apply to types, etc.,
	not just to preds.

mercury_compile.pp, mercury_to_goedel.nl, prog_util.nl:
	Replace to goedel__ prefixes in prog_util.nl with prog_util__.

std_util.nl:
	Change the code for semidet_succeed to avoid determinism warning.
1994-12-29 01:12:12 +00:00
Fergus Henderson
d8c9479872 Override the MERCURY_LIB_OBJS variable when invoking ml.
Makefile.mercury:
	Override the MERCURY_LIB_OBJS variable when invoking ml.
	This avoids some bootstrapping problems.
	Also, add mercury_compile.nu.

Makefile.common:
	Bump NU-Prolog's -u option up to 2000 (8M), to avoid some memory
	problems.

array.nl, bintree.nl, char.nl, dir.nl, globals.nl, list.nl, map.nl, modes.nl,
prog_util.nl, stack.nl, std_util.nl, string.nl, term.nl:
	Avoid the use of implied modes.

code_info.nl, bimap.nl, make_hlds.nl, mercury_compile.nl,
mercury_to_mercury.nl, unify_proc.nl:
	Fix determinism errors which had previously not been discovered
	because of either implied modes or running out of memory.
	(Note that I had to change the interface to bimap__lookup, since
	it's not possible to make it bidirectional.)

code_util.nl, llds.nl, opt_debug.nl, value_number.nl:
	Rename `operator' as `binary_op'.

hlds.nl, code_info.nl, unify_gen.nl, llds.nl, opt_debug.nl, switch_gen.nl:
	*** Handle simple cases of higher-order pred terms. ***
	(We don't yet handle taking the address of an overloaded
	predicate or a predicate with multiple modes.
	We don't handle closures.  call/1 and call/N are not yet implemented.
	This has not yet been tested.)

make_hlds.nl:
	Modify the mode priority ordering so that semidet modes get
	selected before det ones.

llds.nl:
	Don't include the priority part of the mode number in the mangled
	label name.  *** Note: this will break some things! ***

mercury_compile.nl:
	Move the NU-Prolog hacks into mercury_compile.nu.nl.

switch_gen.nl:
	Fix a simple logic bug in handling the grab/slap of the code_info.

prog_io.nl, builtins.nl, int.nl:
	Fix bugs and omissions with handling of the new arithmetic operators.

prog_io.nl:
	As a quick hack, strip off calls to io__gc_call
	(this avoids spurious error messages which are due to
	the fact that we don't get mode analysis right in those cases).
1994-10-02 17:00:57 +00:00
Fergus Henderson
07245508b4 Fix errors in mode declarations (the errors were only detected
prog_util.nl:
	Fix errors in mode declarations (the errors were only detected
	once I fixed det analysis for switches).
1994-08-27 19:17:57 +00:00
Fergus Henderson
534e5c221e Fix lots of determinism problems.
*.nl:
	Fix lots of determinism problems.
1994-07-07 20:16:08 +00:00
Fergus Henderson
987bef62be Add determinism declarations. Fix a few determinism problems.
*.nl:
	Add determinism declarations.  Fix a few determinism problems.
1994-06-17 00:38:40 +00:00
Fergus Henderson
30f5e18b2f Remove map__search_insert; it's not needed and it's not
bintree.nl, map.nl, varset.nl:
	Remove map__search_insert; it's not needed and it's not
	really useful.

bintree.nl:
	Fix determinism problem in bintree__from_list_2.

options.nl, det_analysis.nl, make_hlds.nl:
	Add options to suppress determinism warnings.

det_analysis.nl, hlds.nl, modes.nl:
	Allow the delta-instmap to be `unreachable'.

hlds_out.nl:
	Output the delta-instmap.
	Output conjunctions differently in verbose mode.

llds.nl:
	Fix determinism problem.
	Change GOTO(LABEL(...)) into GOTO_LABEL(...) which can be
	more efficient.

map.nl:
	Add map__overlay/3.

typecheck.nl, modes.nl, mode_errors.nl, options.nl, hlds_out.nl.
	Split the old `debug' option into debug-types and debug-modes.
	Change the default for the `modecheck' option to `yes'.
	Add a new verbose-dump-hlds option, and use that instead
	of the very-verbose option in hlds_out.nl.

mode_util.nl:
	Export mode_get_insts/4.
	Add instmap_lookup_var (moved from modes.nl).
	Add apply_instmap_delta.

modes.nl, term.nl, prog_util.nl:
	Add determinism annotations.

term.nl, prog_io.nl:
	Fix bugs in when declarations.

std_util.nl, prog_io.nl:
	Add a maybe(T) type to std_util.nl.
	Rename the maybe(T) type in prog_io.nl as maybe1(T).
1994-06-16 16:05:59 +00:00
Fergus Henderson
94d9c1abb9 Use det_pred(...), semidet_pred(...), nondet_pred(...)
mercury_builtin.nl:
	Use det_pred(...), semidet_pred(...), nondet_pred(...)
	rather than call_pred(...) for the higher-order predicate modes.

prog_io.nl, io.nl, varset.nl, etc.
	Add determinism annotations.

hlds.nl, make_hlds.nl, LOTS of other files:
	Reorganize the way the predicate table works.
	Make hlds.nl a bit more modular.
	Change call/4 to call/5.
	Remove all/2 from the hlds.
	Changed pred_id to an integer.
	Added pred_call_id which is similar to the old pred_id.

Makefile:
	Add a rule for creating *.hlds_dump.

array.nl:
	Fix determinism error.

det_analysis.nl:
	Fix a bug in printing determinism warnings.

fix_errors.sed:
	Modify this so it allows all the `inferred nondet' determinism
	errors but none of the `inferred semidet' ones.

llds.nl:
	Rename llds__pred_mode_id as llds__proc_id.

mode_errors.nl:
	Finally got around to implementing Zoltan's suggestions
	about the error messages from the mode analysis.
	If an error occurs in a conjunction, only one error message
	is printed out - the first error which doesn't relate to
	a head unification.

modes.nl:
	Handle X = f(X) properly.  NB: determinism analysis and code
	generation still get it wrong!

undef_modes, undef_insts:
	I've broken the error message code, since it's not easy
	to print pred_ids.  I just changed it so that it didn't
	print the pred_ids out.  Should fix this properly at some stage...
1994-06-14 14:23:52 +00:00
Fergus Henderson
8bf2aacf0b Rename a whole bunch of predicates.
*.nl:
	Rename a whole bunch of predicates.
	Apart from some manual changes to list.nl, the changes
	were all generated by applying the following sed script:

/[^a-zA-Z_]goedel_expand(/s/goedel_expand(/prog_util__expand(/g
/[^a-zA-Z_]goedel_replace(/s/goedel_replace(/prog_util__replace(/g
/[^a-zA-Z_]to_upper(/s/to_upper(/char__to_upper(/g
/[^a-zA-Z_]to_lower(/s/to_lower(/char__to_lower(/g
/[^a-zA-Z_]is_upper(/s/is_upper(/char__is_upper(/g
/[^a-zA-Z_]is_lower(/s/is_lower(/char__is_lower(/g
/[^a-zA-Z_]is_alpha(/s/is_alpha(/char__is_alpha(/g
/[^a-zA-Z_]is_alnum(/s/is_alnum(/char__is_alnum(/g
/[^a-zA-Z_]is_alpha_or_underscore(/s/is_alpha_or_underscore(/char__is_alpha_or_underscore(/g
/[^a-zA-Z_]is_alnum_or_underscore(/s/is_alnum_or_underscore(/char__is_alnum_or_underscore(/g
/[^a-zA-Z_]is_digit(/s/is_digit(/char__is_digit(/g
/[^a-zA-Z_]lower_upper(/s/lower_upper(/char__lower_upper(/g
/[^a-zA-Z_]io__op(/s/io__op(/term_io__op(/g
/[^a-zA-Z_]io__current_ops(/s/io__current_ops(/term_io__current_ops(/g
/[^a-zA-Z_]io__read_term(/s/io__read_term(/term_io__read_term(/g
/[^a-zA-Z_]io__write_term(/s/io__write_term(/term_io__write_term(/g
/[^a-zA-Z_]io__write_constant(/s/io__write_constant(/term_io__write_constant(/g
/[^a-zA-Z_]io__write_variable(/s/io__write_variable(/term_io__write_variable(/g
/[^a-zA-Z_]mercury_quote_string(/s/mercury_quote_string(/term_io__quote_string(/g
/[^a-zA-Z_]mercury_quote_atom(/s/mercury_quote_atom(/term_io__quote_atom(/g
/[^a-zA-Z_]mercury_quote_char(/s/mercury_quote_char(/term_io__quote_char(/g
/[^a-zA-Z_]mercury_quote_single_char(/s/mercury_quote_single_char(/term_io__quote_single_char(/g
/[^a-zA-Z_]delay_info_/s/delay_info_/delay_info__/g
/[^a-zA-Z_]process_options(/s/process_options(/getopt__process_options(/g
/[^a-zA-Z_]lookup_option(/s/lookup_option(/globals__lookup_option(/g
/[^a-zA-Z_]append(/s/append(/list__append(/g
/[^a-zA-Z_]member(/s/member(/list__member(/g
/[^a-zA-Z_]merge(/s/merge(/list__merge(/g
/[^a-zA-Z_]member_chk(/s/member_chk(/list__member_chk(/g
/[^a-zA-Z_]length(/s/length(/list__length(/g
/[^a-zA-Z_]condense(/s/condense(/list__condense(/g
/[^a-zA-Z_]same_length(/s/same_length(/list__same_length(/g
/[^a-zA-Z_]split_list(/s/split_list(/list__split_list(/g
/[^a-zA-Z_]reverse(/s/reverse(/list__reverse(/g
/[^a-zA-Z_]delete(/s/delete(/list__delete(/g
/[^a-zA-Z_]delete_first(/s/delete_first(/list__delete_first(/g
/[^a-zA-Z_]sort(/s/sort(/list__sort(/g
/[^a-zA-Z_]nth_member_search(/s/nth_member_search(/list__nth_member_search(/g
/[^a-zA-Z_]nth_member_lookup(/s/nth_member_lookup(/list__nth_member_lookup(/g
/^goedel_expand(/s/goedel_expand(/prog_util__expand(/g
/^goedel_replace(/s/goedel_replace(/prog_util__replace(/g
/^to_upper(/s/to_upper(/char__to_upper(/g
/^to_lower(/s/to_lower(/char__to_lower(/g
/^is_upper(/s/is_upper(/char__is_upper(/g
/^is_lower(/s/is_lower(/char__is_lower(/g
/^is_alpha(/s/is_alpha(/char__is_alpha(/g
/^is_alnum(/s/is_alnum(/char__is_alnum(/g
/^is_alpha_or_underscore(/s/is_alpha_or_underscore(/char__is_alpha_or_underscore(/g
/^is_alnum_or_underscore(/s/is_alnum_or_underscore(/char__is_alnum_or_underscore(/g
/^is_digit(/s/is_digit(/char__is_digit(/g
/^lower_upper(/s/lower_upper(/char__lower_upper(/g
/^io__op(/s/io__op(/term_io__op(/g
/^io__current_ops(/s/io__current_ops(/term_io__current_ops(/g
/^io__read_term(/s/io__read_term(/term_io__read_term(/g
/^io__write_term(/s/io__write_term(/term_io__write_term(/g
/^io__write_constant(/s/io__write_constant(/term_io__write_constant(/g
/^io__write_variable(/s/io__write_variable(/term_io__write_variable(/g
/^mercury_quote_string(/s/mercury_quote_string(/term_io__quote_string(/g
/^mercury_quote_atom(/s/mercury_quote_atom(/term_io__quote_atom(/g
/^mercury_quote_char(/s/mercury_quote_char(/term_io__quote_char(/g
/^mercury_quote_single_char(/s/mercury_quote_single_char(/term_io__quote_single_char(/g
/^delay_info_/s/delay_info_/delay_info__/g
/^process_options(/s/process_options(/getopt__process_options(/g
/^lookup_option(/s/lookup_option(/globals__lookup_option(/g
/^append(/s/append(/list__append(/g
/^member(/s/member(/list__member(/g
/^merge(/s/merge(/list__merge(/g
/^member_chk(/s/member_chk(/list__member_chk(/g
/^length(/s/length(/list__length(/g
/^condense(/s/condense(/list__condense(/g
/^same_length(/s/same_length(/list__same_length(/g
/^split_list(/s/split_list(/list__split_list(/g
/^reverse(/s/reverse(/list__reverse(/g
/^delete(/s/delete(/list__delete(/g
/^delete_first(/s/delete_first(/list__delete_first(/g
/^sort(/s/sort(/list__sort(/g
/^nth_member_search(/s/nth_member_search(/list__nth_member_search(/g
/^nth_member_lookup(/s/nth_member_lookup(/list__nth_member_lookup(/g
/[^a-zA-Z_]delete_all(/s/delete_all(/list__delete_all(/g
/^delete_all(/s/delete_all(/list__delete_all(/g
1994-06-02 16:03:34 +00:00
Fergus Henderson
019ee742f8 Break modes.nl up into separate modules.
modes.nl, mode_errors.nl, delay_info.nl, mode_info.nl, undef_modes.nl:
	Break modes.nl up into separate modules.

toplevel.nl (plus LOTS of other files):
	Change the way module imports are handled.  Fix the resulting missing
	import problems found in most of the modules.

mode_util.nl:
	Add predicate inst_is_bound_to_functors/3.

switch_detection.nl:
	New file.  Still very incomplete.

meta.nl:
	Remove.  This file was old junk.
1994-05-24 07:35:16 +00:00
Fergus Henderson
0ad664520e Rename various things for consistency:
s/term_functor/term__functor/g
	s/term_atom/term__atom/g
	s/term_string/term__string/g
	s/term_int/term__int/g
	s/term_float/term__float/g
	s/term_variable/term__variable/g

	/:- mode.*[^a-zA-Z_]input,/s/input,/in,/g
	/[^a-zA-Z_]input,.*)/s/input,/in,/g
	/:- mode.*[^a-zA-Z_]output,/s/output,/out,/g
	/[^a-zA-Z_]output,.*)/s/output,/out,/g

	/:- mode.*[^a-zA-Z_]input)/s/input)/in)/g
	/:- mode.*[^a-zA-Z_]output)/s/output)/out)/g

	/[a-z]info/s/info/_info/g
	/__info/s/__info/_info/g
1994-05-03 12:28:54 +00:00
Fergus Henderson
4178752860 Fix bugs in the implicit quantification.
make_hlds.nl:
	Fix bugs in the implicit quantification.

Makefile, doit.nl:
	Add stack.nl.

det_analysis.nl:
	Fix minor bug in the error message.

interpreter.nl:
	Print out the answers to the query.

mercury_to_mercury:
	Added mercury_output_hlds_goal.
	Also export mercury_output_vars.

modes.nl:
	Handle reordering of conjunctions.
	Handle variable locking in all cases.
	(Complete, but probably needs some bug fixes.)

prog_util.nl:
	Fix another goddamned bug in the type-checker - I thought
	we'd killed the last of those!  This one was a problem
	in the expansion of equivalence types - failed for map(map(...)).
1994-04-27 11:16:40 +00:00
Fergus Henderson
8720bb03e8 Added a new -h option which solves the NU-Prolog memory management
problem.
1994-03-15 13:35:38 +00:00
Fergus Henderson
5b3da4cdde An error message was omitting the file name & line number.
prog_io.nl:
	An error message was omitting the file name & line number.
	Also ensure that all error messages start with "error:".

codegen.nl, interpreter.nl, bintree.nl, list.nl:
	Fix stuff detected by nit.

make_hlds.nl:
	Transform to `semi-homogeneous' form (still need to expand
	unifications).

prog_util.nl:
	Fix bug.

mercury_builtin.nl:
	Add call/1.

hlds.nl:
	Add a count of the number of errors and warnings to the module_info
	data structure.

toplevel.nl:
	Continue processing after syntax errors.
1994-03-12 06:00:36 +00:00
Fergus Henderson
30baaf2e45 Added predicate varset__vars.
varset.nl:
	Added predicate varset__vars.

term.nl:
	Added predicate term__vars_list.

typecheck.nl:
	Implement two previously unimplemented parts of the typechecker:
	detect attempts to instantiate type variables which occur in
	the predicate's type declaration, and detect any failure to
	bind all other type variables.  (That was the last two;
	apart from

prog_util.nl:
	Fix problem where the expansion of equivalence types was
	introducing fresh variables into the type varset, which caused
	problems in relation to the above changes to typecheck.nl.

hlds_out.nl:
	Fix typo in type declaration (found by above fixes to typechecker).

options.nl:
	Fix bug in type definition introduced by last change.

make_hlds.nl:
	Add a missing pred & mode declaration.

modes.nl:
	Don't display the verbose messages unless the very-verbose
	flag was specified.
1994-03-11 18:57:16 +00:00
Thomas Conway
cb559dee89 Changed if-then-else to -> ;
prog_util.nl:
	Changed if-then-else to -> ;

string.nl:
	Changed if-then-else to -> ;

term.nl:
	Changed if-then-else to -> ; and added an XXX in term__context_init

varset.nl:
	Changed if-then-else to -> ;
1994-03-09 01:21:35 +00:00
Fergus Henderson
30f46e92b0 New file. At the moment it just checks for undefined modes and
modes.nl:
	New file.  At the moment it just checks for undefined modes and
	undefined insts.

Makefile, doit.nl:
	Add new files modes.nl and prog_util.nl.

term.nl:
	Add term__var_to_int.

toplevel.nl:
	Call the mode checker.

prog_io.nl, make_hlds.nl, hlds.nl:
	Allow for the possibility of abstract `inst' definitions,
	just like abstract type definitions.  Currently they
	are allowed for in the data structure, but they aren't
	parsed correctly, and the utilities in hlds.nl don't handle
	them that well.

hlds.nl:
	Move `unqualify_name' to prog_util.nl.

make_hlds.nl:
	Move `split_types_and_modes' to prog_util.nl.

mercury_to_goedel.nl, toplevel.nl:
	Move the equivalence type expansion code to prog_util.nl.

builtin.nl, toplevel.nl:
	Add a new module `builtin.nl' which gets automatically imported
	into every module.  In it, define the standard modes input,
	output, etc., and various other stuff.

std_util.nl:
	Move the defintion for \= to builtin.nl.
	Remove the definition of ~=.

prog_io.nl:
	Export parse_goal/2, since it's used by mercury_to_goedel.

mercury_to_goedel.nl:
	Fix various type errors.

list.nl, int.nl, io.nl, codegen.nl, det_analysis.nl, llds.nl, hlds_out.nl:
	Fix various syntax errors, typos and errors in type and mode
	declarations discovered by mercury_compile.
1994-03-04 12:39:43 +00:00