Commit Graph

20 Commits

Author SHA1 Message Date
Peter Ross
051f701baa Allow prolog version of the compiler to be built.
Estimated hours taken: 0.1

Allow prolog version of the compiler to be built.

library/string.nu.nl:
    Add missing definition of string__from_rev_char_list
1998-06-01 23:54:44 +00:00
Fergus Henderson
986b631dc6 Add code to parse terms from strings rather than from streams.
Estimated hours taken: 24

Add code to parse terms from strings rather than from streams.
The original intention for this change was twofold:
to increase expressiveness and to improve efficiency.
However, for the moment I have given up on the goal of
improving efficiency.

library/io.m:
	Add io__read_file_as_string/{4,5}, for efficiently
	reading a whole file into a single string.
	Add io__read_from_string/5, for reading terms of
	any type from a string.
	(Should that instead be named string__read instead?)

library/string.m:
	Implement string__substring/4 more efficiently,
	using `pragma c_code' rather than by calling
	string__right(string__left(...)).
	Export string__unsafe_index/3, and add new exported
	predicate string__unsafe_substring/4 -- these
	are versions of string__index and string__substring
	that don't check for range errors.  They are
	needed to get reasonable efficiency when dealing
	with very large strings.

library/string.nu.nl:
	Add Prolog implementations of string__substring
	and string__unsafe_substring.

library/lexer.m:
	Add lexer__string_get_token_list/{5,6}, for parsing
	tokens from a string.  This required adding
	`string_' versions of most of the lexical analysis routines.
	XXX lots of code duplication, I'm afraid.
	XXX the string versions are not as efficiency as they
	    could ideally be.

library/parser.m:
	Add new predicates parser__read_term_from_string/{4,6}
	and parser__parse_token_list.

compiler/bytecode_gen.m:
compiler/error_util.m:
compiler/fact_table.m:
compiler/term_errors.m:
	Minor changes to use term__context as an ADT rather than
	as a concrete data type.

In addition, I made the following changes, which I am NOT committing.

compiler/prog_io.m:
	Change to use io__read_file_as_string and
	parser__read_term_from_string.
	(Not committed because the existing method is
	in currently more efficient.)

library/term.m:
	Add new alternative term__detailed_context to the term__context type.
	This alternative can record both the start and end of a term rather
	than just the end.
	(The lexer now has almost all the necessary support for detailed
	contexts, but enabling it would have some potentially significant
	efficiency costs, and curently the parser uses only single contexts
	rather than ranges; so currently this is not used.)
1998-05-21 16:52:20 +00:00
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
Fergus Henderson
c486139acd Remove one of the two copies of string__unsafe_index.
Estimated hours taken: 0.25

library/string.nu.nl:
	Remove one of the two copies of string__unsafe_index.
	One copy is plenty ;-)
1997-07-24 07:26:16 +00:00
Thomas Conway
aaa1787605 add string__unsafe_index. I thought I approved a diff from
Estimated hours taken: 0.1

library/string.nu.nl:
	add string__unsafe_index. I thought I approved a diff from
	fjh, but then again, maybe I only thought I did....
1997-07-22 04:12:14 +00:00
Fergus Henderson
ebe52e7e53 Add a Prolog definition for string__unsafe_index/3, which
Estimated hours taken: 0.25

library/string.nu.nl:
	Add a Prolog definition for string__unsafe_index/3, which
	is defined using `pragma c_code' in string.m.
1997-07-14 03:38:15 +00:00
Simon Taylor
b324a6f64d Added string__contains_char/2.
Estimated hours taken: 0.25

library/string.nu.nl
	Added string__contains_char/2.

library/mercury_builtin.m
	Removed duplicate calls.
1997-01-20 03:32:55 +00:00
Fergus Henderson
96d04bb9b8 Implement string__float_to_f_string in NU-Prolog. (The C
Estimated hours taken: 0.25

library/string.nu.nl:
	Implement string__float_to_f_string in NU-Prolog. (The C
	implementation version of this predicate was recently added by
	petdr; it also needs an NU-Prolog implementation.)
1996-04-22 18:54:15 +00:00
Dylan Shuttleworth
eade28c8b1 Allow predicate and mode definitions, and predicate calls to have
compiler/*
	Allow predicate and mode definitions, and predicate calls to have
	module qualifiers.  This allows a restricted form of predicate
	name overloading.

compiler/llds.m, prog_io.m
	In addition to above, these modules now write some labels in `*.c'
	output files with module-name qualifiers.  Predicate `main/2',
	predicates of `mercury_builtin' and special predicates with names
	like `__*__' are not qualified.

compiler/mercury_to_goedel.m
	This module is probably a little more broken than before, as
	module:qualifiers are ignored.



library/char.*, *
	Change some predicate names from `char_*' to `char__*' for better
	consistency, nicer `c' labels.

library/*, compiler/*
	Change calls to predicates `char_*' to `char__*'.
1995-10-17 04:55:22 +00:00
Fergus Henderson
6fe319bbc7 Fix bug in string_to_float.
string.nu.nl:
	Fix bug in string_to_float.
1995-06-23 15:37:14 +00:00
Fergus Henderson
221b17ef3f Move string__first_char/3 and string__split_string/4 from
library/{string.m,string.nu.nl}:
	 Move string__first_char/3 and string__split_string/4 from
	 string.m into string.nu.nl.
1995-04-17 23:41:46 +00:00
Fergus Henderson
415237a8c2 Move the definitions of string__length/2, string__index/2, and
string.m, string.nu.nl:
	Move the definitions of string__length/2, string__index/2, and
	string__append/3 from string.m into string.nu.nl, since for
	Mercury they are now implemented in runtime/io.mod.
1995-04-15 06:12:22 +00:00
Fergus Henderson
f22f5bdc4b Use a more elegant implementation of string__float_to_string,
library/string.nu.nl:
	Use a more elegant implementation of string__float_to_string,
	as suggested by Jeff Schultz.

library/string.m:
	Fix typo in comment.
1995-04-08 05:59:19 +00:00
Fergus Henderson
93a755d563 Add copyright notices.
library/*:
	Add copyright notices.
1995-03-28 16:19:34 +00:00
Fergus Henderson
6b3448ae9c In `string__to_float', handle strings that don't contain
library/string.nu.nl:
	In `string__to_float', handle strings that don't contain
	a decimal point.  (The implementation technique of calling
	`sread' still sucks.  NU-Prolog doesn't seem to have any
	easy way of doing this.)
1995-03-26 14:52:34 +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
Fergus Henderson
e05b1b4780 Implement string__to_int using string__base_string_to_int(10, ...)
string.nl, string.nu.nl:
	Implement string__to_int using string__base_string_to_int(10, ...)
	rather than as a primitive in Prolog / C.
1995-02-02 12:06:49 +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
e0a02e7adb Remove the unused `declared_determinsm' field in the goal_info.
hlds.nl, hlds_out.nl, det_analysis.nl:
	Remove the unused `declared_determinsm' field in the goal_info.
	Rename the `inferred_determinism' field as just `determism'.
	Add a new field `local_determinism'.  In det_analysis.nl,
	Plug the contents of the new `local_determinsm' field in the goal_info
	into the computation of the determinism for each goal.

det_analysis.nl, fix_errs.sed:
	For the cases which we currently don't handle correctly,
	generate incorrect code in preference to generating spurious
	error messages (we still have to handle these cases sometime,
	but this means that we can deal with them one at a time).

arg_info.nl, builtins.nl, code_gen.nl, delay_info.nl, det_analysis.nl,
getopt.nl, globals.nl, make_hlds.nl, modes.nl, mode_util.nl, stack.nl,
string.nl, string.nu.nl, term.nl, undef_modes.nl, varset.nl:
	Fix determinism errors uncovered by the changes in the determinism
	analysis.
1994-06-27 03:34:09 +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