Commit Graph

29 Commits

Author SHA1 Message Date
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
Fergus Henderson
4414b6c975 Print line numbers in "%03d" format, so that columns in the
Estimated hours taken: 0.5

prog_io.m, prog_out.m:
	Print line numbers in "%03d" format, so that columns in the
	error messages line up nicely.
1996-01-21 14:26:10 +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
Fergus Henderson
b87de68334 Implement unique modes. We do not handle local aliasing yet, so this
-------------------------------------------------------

Implement unique modes.  We do not handle local aliasing yet, so this
is still not very useful, except for io__state.  Destructive update is
not yet implemented.  Also note that this really only implements
"mostly unique" variables that may be non-unique on backtracking - we
don't check that you don't backtrack over I/O, for example.

prog_io.m, mode_util.m, modes.m, inst_match.m:
	Major changes to Handle unique modes.

mercury_to_mercury.m, polymorphism.m, prog_out.m, undef_modes.m:
	Use `ground(Uniqueness)' rather than just `ground'.

compiler/*.m:
	Fix compile errors now that unique modes are enforced: add a
	few calls to copy/2, and comment out lots of unique mode
	declarations that caused problems.

typecheck.m, mode_info.m:
	Hack around the use of unique modes, which doesn't work
	because we don't allow local aliasing yet: make the insts
	`uniq_type_info' and `uniq_mode_info' not unique at all,
	and add a call to copy/2 when extracting the io_state from
	type_info or mode_info.

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

Plus a couple of unrelated changes:

hlds.m:
	Change the modes for the special predicates from `ground -> ground'
	to `in', so that any error messages that show those modes
	come out looking nicer.

	Add a new shared_inst_table for shared versions of user-defined
	insts.

mercury_to_goedel.m:
	Use string__is_alnum_or_underscore.
1995-08-02 07:53:53 +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
a05cf978f1 Change (A -> B) into (A -> B ; []) in DCGs.
mercury_to_goedel.nl, prog_out.nl:
	Change (A -> B) into (A -> B ; []) in DCGs.
1995-02-02 08:21:45 +00:00
Fergus Henderson
1a977ea19a Replace all occurrences of `not(Vars, Goal)' with just
*.nl:
	Replace all occurrences of `not(Vars, Goal)' with just
	plain `not(Goal)'.

type_util.nl, switch_gen.nl:
	Higher-order pred types are not user-defined types.
	Add a `predtype' type category for them.

call_gen.nl:
	Change call_closure/2 to call_closure/3 (with liveinfo).
	Plus a little bit of random hacking.
1995-01-10 18:35:59 +00:00
Fergus Henderson
fd2470dd0a Add some more stuff for compiling to .o
Makefile*:
	Add some more stuff for compiling to .o

Makefile*, mercury_compile*, code_gen*:
	Add some stuff for handling `.pp' files.
	`.pp' files are Mercury source code containing
	NU-Prolog hacks inside

		#if NU_PROLOG
		...
		#endif

	These hacks are preprocessed out (using sed, not cpp)
	except when compiling with `mnc'.

term_io.nl, term_io.nu.nl, interpreter.nl, prog_out.nl:
	Make sure all the predicates in term_io.nl are
	prefixed with `term_io__', not `io__'.

term_io.nl, require.nl:
	Add some `external' declarations.

call_gen.nl, unify_gen.nl:
	A temporary hack - generate incorrect code for complicated/polymorphic
	unifications, rather than aborting.

random.nl:
	Make the code more efficient.

hlds.nl, term.nl:
	Allocate pred_ids and variable numbers randomly rather than
	sequentially, so that the binary trees remain reasonably balanced.

code_info.nl, unify_gen.nl, hlds_out.nl:
	Generate informative comments for tag tests: say the name of
	the variable being tested, and which constructor we are testing for.

llds.nl:
	Cast field() expressions to (int) when used as rvals, so
	that comparisons work as expected.

make_hlds.nl:
	Improve error reporting.
1994-10-09 18:26:41 +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
59b9b968ab Remove some unused junk.
prog_out.nl:
	Remove some unused junk.
1994-03-23 13:32:56 +00:00
Fergus Henderson
03a150be26 Export prog_out__write_module_spec. 1994-02-23 01:45:30 +00:00
Fergus Henderson
83446de253 Isolate the assumption that strings are just lists
string.nl, string.nu.nl, Makefile, doit.nl:
	Isolate the assumption that strings are just lists
	of integers into a new file string.nu.nl, so that
	string.nl will type-check properly.

int.nl: bug fix.

hlds.nl: add predicate `predinfo_context'.

hlds_out.nl: lots of misc. changes to get it past the type-checker.

typecheck.nl: improve the error messages a little.

varset.nl: bug fix.
1994-02-15 06:56:46 +00:00
Fergus Henderson
356748aaf5 toplevel.nl: write hlds dump to a file, not to stdout
toplevel.nl, mercury_to_goedel.nl, hlds.nl:
move unqualify_name/2 to hlds.nl.

typecheck.nl: Fix design problem with typevarsets; fix bug where I had
forgotten to rename apart the types for constructors.

prog_io.nl, prog_out.nl: improve error messages.

various: inlined calls to require/2 to improve efficiency.

various: added an extra arg to io__progname to specify the default
	 in case the program name isn't available.
1994-02-10 09:35:55 +00:00
Fergus Henderson
91e9e3270b Replace all calls to write/1 with calls to io__write_anything/3 or error/1. 1994-01-31 04:18:14 +00:00
Fergus Henderson
55839f463c builtins.nl: added `when' declarations.
bintree.nl: modified tree structure slighyl to improve efficiency.

io.nl, io.nu.nl: added predicate io__stream_name and code to keep track
	of the name of each stream.

term.nl: store filenames as part of term__context.
prog_out.nl: print out the filename part of a term__context
term_io.nl: initialize the filename when reading in a term

list.nl: add member_chk/2.

various places: replace `integer' with `int'.

did a bit more work on the type-checker.  It now runs without crashing,
although the results are still buggy.

toplevel.nl: added code to read in a module and all the modules
	that it depends upon.

added code to handle abstract type definitions.
1994-01-28 18:54:25 +00:00
Fergus Henderson
955c1512de mercury_to_goedel.nl: hack it to work for llds.nl.
prog_out.nl: remove various bits of crud and clean it up a little.

hlds.nl: add some stuff needed by typecheck.nl

typecheck.nl: did a bit more work on this.

renamed module.nl as toplevel.nl and also rewrote it using stuff
from mercury_to_goedel.nl.
1994-01-26 15:20:07 +00:00
Fergus Henderson
532c27523f Split io.nl into io.nl and term_io.nl.
Moved most of the non-logical NU-Prolog code from io.nl and term_io.nl into
io.nu.nl and term_io.nu.nl respectively.  Rewrote the rest in logical Mercury.
Modified io__write_term to escape string constants if necessary.

Added char.nl and moved some of the predicates in string.nl into char.nl.
Rewrote some of the predicates in these files to avoid NU-Prolog dependencies.
Added a few new predicates.

Modified mercury_to_goedel.nl to correctly output variable names without
any danger of name clashes.  Also modified it to correctly escape string
constants.  Also modified it to correctly output functor names even
for nasty functors.

Did a little more work on the typechecker.

Moved the non-logical NU-Prolog code in require.nl into require.nu.nl.

Fix bug in prog_io.nl where combined type-and-mode declarations were
getting reversed.

Modified io.nu.nl and require.nu.nl so that calls to error/1 will
actually cause the program to abort.

In prog_io.nl: allow "\+" as a synonym for "not".
1994-01-25 13:48:40 +00:00
Fergus Henderson
9ba4a542e0 Added code to parse determinacy annotations.
Also misc. bug fixes.
1994-01-24 14:07:19 +00:00
Fergus Henderson
88b37f2c0b - Add code to silently ignore NU-Prolog `when' declarations (rather than
reject them as syntax errors).
- Change predicates in term.nl to use `term__' prefix instead of `term_'.
- Change predicates in string.nl to use `string__' prefix instead of `string_'.
- Change the types in prog_io.nl so that they store determinism
  annotations for mode and predicate declarations (the code still needs
  to be fixed to parse these new annotations.)
- Add some new predicates to term.nl.
- Did some more work on mercury_to_goedel.nl.
- Various bug fixes.
1994-01-24 03:36:42 +00:00
Fergus Henderson
5c094a8cb4 Fix typos in error messages. 1994-01-18 07:13:30 +00:00
Fergus Henderson
fc6695ac39 Store a term_context (line number) in various important places
in the hlds.  Add line numbers to all the error messages produced
by make_hlds.nl.
1994-01-10 13:07:06 +00:00
Fergus Henderson
3ddf6bfb05 Improved error reporting in the parser: it now reports the line number
where the error occurred.
Note that line numbers are still not stored in the hlds yet, so
we need to do some more work so that the typechecker, etc. can also
report line numbers.
1994-01-10 09:06:54 +00:00
Fergus Henderson
90c2b4f368 Added `author' comment to all source files.
Lots of bug fixes for make_hlds.nl.
A couple of bug fixes for hlds.nl.
Did some optimization of memory usage: added io__gc_call to io.nl
and used it in prog_io.nl and module.nl.  Rewrote the main loop
of prog_io to take maximum advantage of manual garbage collection.
Started working on typecheck.nl.
1993-12-28 11:35:16 +00:00
Fergus Henderson
42915a7172 Added some comments. 1993-12-03 09:02:15 +00:00
Fergus Henderson
ba050eeb69 bug fixes 1993-12-01 19:15:13 +00:00
Fergus Henderson
701311514f Add some code to print out the parse tree. 1993-12-01 18:49:04 +00:00