Commit Graph

36 Commits

Author SHA1 Message Date
Fergus Henderson
92d1371b4c New file: converts the prog_io data structure back into Mercury source
mercury_to_mercury.nl:
	New file: converts the prog_io data structure back into Mercury source
	code.

term_io.nl:
	Export mercury_quote_string for use by mercury_to_mercury.nl.

Makefile, doit.nl:
	Add mercury_to_mercury.

options.nl, toplevel.nl:
	Add a new option to save the interface of a module to a `.int' file,
	using mercury_to_mercury.

Makefile:
	Modify the rule for the `clean' target so that it removes `.int' files.

mercury_builtin.nl:
	Fix the module name.

std_util.nl:
	Suppress warnings from nit.
1994-03-14 14:53:58 +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
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
Fergus Henderson
8da0e9cb59 Modified io__read_term in term_io.nl to return the line number with
syntax errors, so that prog_io.nl can get an accurate line number for
them.  (Also had to modify interpreter.nl since it called io__read_term.)
1994-02-23 11:34:17 +00:00
Fergus Henderson
13ef3d2ea6 prog_io.nl: fix bugs in the DCG expansion. 1994-02-23 00:36:03 +00:00
Fergus Henderson
ba8368ce10 Expand DCG clauses in prog_io.nl rather than use NU-Prolog's expandTerm
in term_io.nu.nl.  NOT YET TESTED!
1994-02-22 06:57:17 +00:00
Fergus Henderson
f0870f671e Everywhere: replace variable' with var'.
parser.nl: did some more work on this
1994-02-18 06:03:28 +00:00
Fergus Henderson
02c2a93c4c typecheck.nl: A couple of minor fixes; fix bug with constants of builtin types.
Optimize for the common case of non-polymorphic types & predicates.

term.nl: Rename term__apply_substitution as term__apply_rec_substitution
	and add a new term__apply_substitution for when you want
	non-recursive application.  Fix logic bug in
	term__substitute_corresponding.

varset.nl: Fix logic bug in varset__merge.

io.nu.nl: Fix typo in error message.

term_io.nu.nl: Fix bug in the code used to work-around the NU-Prolog
	getToken bug for empty strings.

prog_io.nl: Fix bug: the string "\+" should have been "\\+".
	Also fixed LOTS of type errors (discovered by the typechecker,
	hurray it now works!).

int.nl, list.nl, std_util.nl: Added pred & mode declarations for some
	NU-Prolog predicates that we are using.
1994-02-10 15:02:25 +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
1e4edbe9fc Bug fixes.
Also rearranged the interface declarations in a couple of modules.
1994-02-02 11:24:56 +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
843462bbb9 io.nl & io.nu.nl: add predicates dealing with streams.
prog_io.nl: fix bug where binop_to_term returned a list in the reverse order.

mercury_to_goedel.nl: write diagnostics to stderr instead of stdout.
1994-01-26 02:57:50 +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
6a30dbd726 - Replaced "import_module integer" with "import_module int".
- Added some new targets to the Makefile.
- In mercury_to_goedel.nl: handle calls to require/2.
- Replaced "require(fail, ...)" with "error(...)".
- Removed uses of floating point division in array.nl.
- Changed io__progname to take two io__state arguments.
- Removed direct references to $string from io.nl so that it is self-applicable.
- Added pair.nl and changed map.nl to use it.
1994-01-24 10:04:04 +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
24c7643b8d Fix bug whereby `some [Vars] Goal' was not being parsed correctly.
Allow `A->B;C' as a synonym for `if A then B else C', and `A->B'
as a synonym for `if A then B'.
1994-01-19 16:14:34 +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
7901760617 Add special hack to allow you define ';'/2 constructors. 1994-01-04 16:01:06 +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
9dc8da41f6 Add a couple of comments. 1993-12-18 14:51:05 +00:00
Fergus Henderson
6f5561e2fe Parse unifications. 1993-12-14 05:52:10 +00:00
Thomas Conway
aa687bc114 A bit of testing in codegen, a tiny bugfix to prog_io, and a couple of
small additions to hlds.
1993-12-10 04:17:11 +00:00
Fergus Henderson
1e020100f4 Parse constructors properly. 1993-12-07 04:20:34 +00:00
Fergus Henderson
fc8b5cc89c Bug fixes. 1993-12-03 08:51:12 +00:00
Fergus Henderson
90c472c950 Minor changes and bug fixes. 1993-12-01 18:47:05 +00:00
Fergus Henderson
91737ed565 Added code to parse mode declarations. 1993-12-01 11:55:55 +00:00
Fergus Henderson
63673c13f3 Modified the comments. 1993-11-30 16:23:13 +00:00
Fergus Henderson
f4d0c32e52 Various changes. It now successfully parses itself! 1993-11-30 13:03:01 +00:00
Fergus Henderson
2dacf05303 Added comments, mode declarations, code to parse inst & mode definitions. 1993-11-30 05:19:48 +00:00
Fergus Henderson
e875cde847 Minor bug fix. 1993-11-28 13:43:37 +00:00
Fergus Henderson
50340cae7c Finished parsing for module declarations (except operator fixity). 1993-11-28 12:44:03 +00:00
Fergus Henderson
0f5180bfb4 Fixed a few loose ends. Still lots of work to be done here. 1993-11-28 06:17:28 +00:00
Fergus Henderson
f06bac3997 Added the compiler sources to the CVS repository. 1993-11-22 07:21:21 +00:00