Estimated hours taken: 3
A bunch of cleanups: improve error messages, tidy up the code.
Also, do some work towards supporting higher-order functions.
type_util.m:
Add new predicate type_is_higher_order/3 for checking
whether a type is a higher-order type. This recognizes
both higher-order predicate types and also higher-order
function types.
code_info.m, modes.m, polymorphism.m, shapes.m:
Use type_is_higher_order/3.
make_hlds.m:
Fix another error message to do the right thing when
reporting errors for functions.
mercury_to_mercury:
List `func' in the table of operators, so that it gets
parenthesized correctly.
modes.m, mode_errors.m:
Improve the error message for attempted higher-order unifications:
spit out some context, and if verbose_errors is enabled, spit
out a long description.
Estimated hours taken: 10
hlds, hlds_module, hlds_pred, hlds_goal, hlds_data:
Divided the old hlds.m into four files:
hlds_module.m defines the data structures that deal with issues
that are wider than a single predicate. These data structures are
the module_info structure, dependency_info, the predicate table
and the shape table.
hlds_pred.m defined pred_info and proc_info, pred_id and proc_id.
hlds_goal.m defines hlds__goal, hlds__goal_{expr,info}, and the
other parts of goal structures.
hlsd_data.m defines the HLDS types that deal with issues related
to data and its representation: function symbols, types, insts, modes.
It also defines the types related to determinism.
hlds.m is now an empty module. I have not removed it from CVS
because we may need the name hlds.m again, and CVS does not like
the reuse of a name once removed.
other modules:
Import the necessary part of hlds.
det_analysis:
Define a type that was up to now improperly defined in hlds.m.
prog_io:
Move the definition of type determinism to hlds_data. This decision
may need to be revisited when prog_io is broken up.
dnf, lambda:
Simplify the task of defining predicates.
llds:
Fix some comments.
mercury_compile:
If the option -d all is given, dump all HLDS stages.
shape, unused_args:
Fix formatting.
Estimated hours taken: 2
code_exprn:
When we are processing the flushing of create expressions, make sure
the Lval we are creating into isn't a field reference. This avoids
deep field of field of field of ... nesting. It does introduce
references to high register numbers, but this is a lesser evil,
and Tom and I plan to fix this anyway.
arg_info, globals, options:
Change --args old to --args simple.
options:
Make some help messages more specific.
code_aux, code_exprn, code_info, det_report, make_hlds, mercury_to_goedel,
prog_io, typecheck:
Changes to accommodate the move from varset__lookup_name
to varset__search_name.
Estimated hours taken: 12
Fixes for two bugs in mode analysis, and
a first cut at support for `any' insts.
(The support for `any' is very preliminary,
has had only the most minimal of testing, and
doubtless has some bugs.)
inst_match.m mercury_to_mercury.m mode_util.m modes.m undef_modes.m
unique_modes.m prog_io.m:
Add new type of inst `any(uniqueness)' to prog_io.m, and
change inst_match.m, mode_util.m, and other places to handle
handle `any' insts.
inst_match.m:
Fix bug in inst_merge: when merging `unique(f(ground)) and `unique',
the result should be `ground', not `unique', since part of the
data structure may be shared. (This fix required adding several
new predicates: `merge_uniq_bound' etc.)
inst_match.m mercury_to_mercury.m mode_util.m modes.m polymorphism.m
prog_io.m switch_detection.m unique_modes.m:
Fix a design bug: in a `bound' inst, the list of bound_insts
must be sorted on the name+arity, not on the name+arg_insts.
To achieve this, I changed the type of the first argument of
functor/2 in the type bound_inst from `const' (just name) to
`cons_id' (name+arity).
Estimated hours taken: 1
compiler/polymorphism.m:
Allow pragma_c_codes to access the type_info parameters by
using the name `TypeInfo_for_T' to access the type_info variable
for type parameter `T'.
Estimated hours taken: 0.5
compiler/polymorphism.m:
Ensure that we don't try to optimize calls to type_to_term
when the type is known, because type_to_term is not yet
implemented and if we try to optimize them, we get map__lookup failed.
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.
Estimated hours taken: 16
This check-in combines several changes.
* Change mercury_compile.pp so that it continues as far as possible
after errors.
* Split the parts of mercury_compile.pp which handle module
imports and exports into a new module called `modules.m'.
* Move the polymorphism.m pass after determinism analysis and unique mode
checking. This is because unique_modes.m may change the mode in which
a unification predicate is called; as a result, we need to do mode
checking, determinism analysis, and unique mode checking for new
modes of unification predicates which are requested only after
unique mode checking. That won't work if we have done polymorphism.m
in between mode checking and determinism analysis, since unification
predicates are created without type_info arguments, and polymorphism.m
cannot be run on just one predicate at a time. (NB. I haven't changed
unique_modes.m to actually do this yet.)
I also had to move lambda.m after polymorphism.m, since polymorphism.m
doesn't handle higher-order pred constants.
* Fix determinism analyis of simple_test unifications.
The compiler would think that a unification of an inst such as
`bound(foo)' with itself could fail. The problem is that there is no
`can_fail' field for simple_test unifications, so determinism.m just
assumes that they can all fail. I fixed this by changing modes.m to
optimize away simple_tests that cannot fail.
* Fix determinism analyis of complicated_unifications.
Again, determinism analysis just assumed that all complicated_unifications
were semidet, because unify_proc.m always declared the out-of-line
unification predicates to be semidet. The fix was to pass the determinism
inferred during mode analysis to unify_proc__request_unify.
However, the '='(in, in) mode still needs to be semidet - its address is
taken and put into the type_infos, and so it needs to have the
right interface. To handle det '='(in, in) unifications, the
determinism also needs to be passed to unify_proc__search_mode_num,
which will select the '='(in, in) mode only if the determinism is
semidet. (It would of course be better to optimize det '='(in, in)
unifications to `true', but they are unlikely to occur much in real
code anyway, so that is a low priority.)
* Compute the instmap deltas for all variables, not just the non-local
variables of a goal, because variables which are not present in a goal
can become nondet live if the goal is e.g. a nondet call.
mercury_compile.pp:
- Rearrange the order of the passes as described above.
- Add code to call check_undef_types and check_undef_modes
directly rather than via typecheck.m/modes.m.
Stop only if we get an undef error; if we get any other
sort of type/mode error, we can keep going.
- Move lots of code to modules.m.
modules.m:
New file, containing code moved from mercury_compile.pp.
polymorphism.m:
Make sure that the goals that we generate have the correct
determinism annotations. Handle switches.
Put back the call to lambda__transform_lambda.
lambda.m:
Put back the stuff that allowed lambda.m to be called from
polymorphism.m.
modes.m, unify_proc.m, call_gen.m, polymorphism.m,
Pass the determinism of the unification to unify_proc__request_unify,
so that it can declare the right determinism for the unification
predicate. (Previously it just assumed that all complicated
unifications were `semidet'.)
Also pass the determinism to unify_proc__search_mode_num, so that
it will generate a new unification pred for deterministic '='(in,in)
unifications rather than calling the existing semidet one.
modes.m, typecheck.m:
Remove the calls to check_undefined_types and check_undefined_modes.
They are now instead called directly from mercury_compile.pp.
modes.m:
Don't call lambda__transform_lambda.
Optimize away simple_tests that cannot fail.
modes.m, unique_modes.m:
Call mode_info_get_instmap/2 rather than mode_info_get_vars_instmap/3.
mode_info.m:
Delete the predicate mode_info_get_vars_instmap/3.
Estimated hours taken: 6
Rearrange the ordering of the different phases in the compiler.
Moved lambda elimination (lambda.m) after unique_modes.m,
because mode analysis must have been fully completed before lambda
elimination, so that we get the right mode on the introduced
predicates. Also moved inlining.m and common.m after unique modes,
since they are optimization passes, not semantic checking passes.
The cse_detection.m, switch_detection.m, and determinism.m passes now
need to recursively traverse lambda goals. (Previously they assumed
that lambda goals had already been eliminated.)
mercury_compile.pp:
Move the inlining.m and common.m passes from semantic_phases
to middle_phases.
polymorphism.m:
Remove the code which called lambda.m.
switch_detection.m:
Recursively traverse lambda goals.
cse_detection.m:
Recursively traverse lambda goals.
Also, when redoing mode analysis and switch detection,
we shouldn't reinvoke lambda.m.
det_analysis.m, det_report.m:
Recursively traverse lambda goals, check for determinism
errors in them, and report them.
Also, print the calling predicate name & mode in the error
message for calls to predicates with cc_* determinism in
all-solutions contexts.
modes.m:
Add an extra argument to modecheck_unification that specifies
how we should recursively process lambda goals, so that we
can do the right thing when called from unique_modes.m.
The right thing in this case is to call unique_modes__check_goal
instead of modecheck_goal, and to then invoke lambda__transform_lambda
on the result.
unique_modes.m:
Make sure we don't clobber the predicate table, since we now
indirectly call lambda__transform_lambda, which inserts new
predicates into the table.
Also, simplify the code a little and add a sanity check.
lambda.m:
Make some changes that were needed because lambda.m now comes
directly after (unique_)modes.m not after polymorphism.m.
Estimated hours taken: 2
Fix some bugs with higher-order preds in data structures.
modes.m:
Make sure we don't try to insert higher-order preds
unifications into the unify_request queue.
polymorphism.m:
Make sure that we handle higher-order unifications by
calling builtin_unify_pred (which does a runtime error)
rather than trying to find the non-existent unification
predicate for the pred type.
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
Estimated hours taken: 0.3
compiler/polymorphism.m:
Fix some of the comments at the top which had become very out-of-date.
(Thanks to benyi for pointing this out.)
Estimated hours taken: 4
Fix bug that Tom found in his new code for graph.m,
where polymorphism.m / lambda.m introduced a new lambda
predicate without passing the type_info argument it needed.
The problem was because polymorphism.m was that polymorphism
was stuffing up the goal_info non-locals fields by introducing
extra type_info variables, calling process_lambda (which used the
goal_info non-locals field!), and then at the end fixing up the
non-locals fields for the whole procedure body.
compiler/polymorphism.m:
Make sure we fix up the goal_info non-locals before
calling process_lambda.
Estimated hours taken: 3
Fix bug in C interface: if there was a pragma(c_code, ...) declaration
for a polymorphicly typed predicate, the compiler would get an internal
error, because the number of arguments in the pragma_c_code goal
would not match the number of arguments in the proc_info for that
predicate, so the call to assoc_list__from_corresponding_lists in
compiler/polymorphism.pp:
Add extra type_info arguments to pragma_c_code goals.
compiler/code_gen.pp:
If a variable in a pragma_c_code goal does not occur in the
arg_info map (e.g. it is a type_info argument introduced
by polymorphism.m), just ignore it.
Estimated hours taken: 15
(Debugging 3 people * 3 hours, design 2 hours, coding 4 hours.)
Fix design error which led to the bug reported by Philip Dart:
cse_detection was reinvoking mode analysis, which converted
higher-order pred terms into lambda expressions, but was
not reinvoking polymorphism.m, and so they remained as
lambda expressions, which caused the code generator to generate
incorrect code.
compiler/polymorphism.m:
Move the stuff for handling lambda expressions into
a new file lambda.m.
compiler/lambda.m:
New file. Contains the lambda expression handling
stuff from polymorphism.m, plus new code to traverse
the HLDS for a predicate applying this transformation
to each lambda expression in the procedure bodies
for that predicate.
compiler/cse_detection.m:
After re-running mode analysis, invoke lambda__process_pred
to transform away lambda expressions.
Estimated hours taken: 2
Fix a bug reported by Tom Conway.
compiler/polymorphism.m:
Disable the optimization of not introducing separate predicates
for lambda closures, since this optimization is sometimes
invalid.
1. A bug fix and a new warning for quantification
quantification.m:
Fix bug in renaming apart of lambda goals: it used to
sort the lambda variables. Improve efficiency slightly.
Add some comments for quantification__rename_apart.
Use more informative variable names in a couple of places.
quantification.m, make_hlds.m, mercury_to_mercury.pp, options.m:
Add code to quantification.m to detect variables with
overlapping scopes, and pass back a list of warnings.
Add code to make_hlds.m to print out the warnings, if
the new option warn_overlapping_scopes was enabled (as
it is by default). Add code to options.m and
mercury_to_mercury.pp to handle the new warning
option.
common.m, cse_detection.m, follow_code.m, unify_proc.m,
Add an extra argument `_Warnings' to calls to
`implicitly_quantify_clause_body', as required by the
above change.
goal_util.m:
Export the predicate goal_util__rename_var_list for use by
quantification.m.
2. A (very incomplete) start to a new backend which will generate
high-level, debuggable C code.
options.m:
Add new option --high-level-C.
mercury_to_mercury.pp:
Handle new option.
mercury_to_c.m:
New file.
llds.m, hlds_out.m:
Export predicates for use by mercury_to_c.m.
:- pragma(inline, predicate/arity).
This declaration means that the corresponding predicate will be inlined.
hlds.m: Add a field to the pred_info indicating whether or not to
inline the pred automatically.
make_hlds.m: Turn on the inline flag in the pred_info if there was a
pragma(inline, ...) declaration.
prog_io.m: Parse the new declaration.
mercury_to_mercury.m:
Spit out the new dec.
inlining.m: Inline the predicate if the inlining field is set in the
pred_info.
polymorphism.m:
code_aux.m: Add an extra paramater to calls to pred_info_init.
The changes made allow declarations of the form:
:- pragma(c_code, predname(Varname1::mode1, Varname2::mode2, ...),
"Some C code to execute instead of a mercury clause;").
There are still a couple of minor problems to be fixed in the near future:
If there is a regular clause given as well as a pragma(c_code, ...) dec, it
is not handled well, and variables names '_' are not handled well.
prog_io.m:
parse the pragma(c_code, ...) dec.
hlds.m:
define a new hlds__goal_expr 'pragma_c_code'.
make_hlds.m:
insert the pragma(c_code, ...) dec. as a pragma_c_code into the hlds.
det_analysis.m:
infer that pragma_c_code goals are det.
modes.m:
convince the mode checker that the correct pragma variables are bound
etc.
quantification.m:
quantify the variables in the pragma(c_code, ...) dec.
code_gen.pp:
convert pragma_c_code into pragma_c (in the llds).
llds.m:
define a new instr, pragma_c. Output the pragma_c
hlds_out.m:
mercury_to_mercury.m:
mercury_to_goedel.m:
spit out pragma(c_code, ...) decs properly
*.m: handle the new pragma_c_code in the hlds or the new pragma_c in the llds
compiler/polymorphism.m:
Fix two bugs with higher-order predicates.
The first one was that it was optimizing
P = lambda([X::out] is nondet, p(Y, X))
^^^^^^
to
P = p(Y)
even in the case where p/2 is semidet, which is wrong.
The second one was that it computing the modes of introduced
lambda-predicates incorrectly; this caused switch_detection
to fall over with "Software error: lists of different length",
because the length of the mode list didn't match the number of
arguments.
compiler/Mmake:
Add EXTRA_MLFLAGS variable, so that you can set
EXTRA_MLFLAGS=--no-strip if you want to preserve
the debugging info.
code_util.m, polymorphism.m, hlds.m, special_pred.m:
Move the stuff dealing with special_preds from hlds.m into
a new module special_pred. Add a new predicate special_pred_get_type
to that module, and use it in code_util.m and polymorphism.m
(replacing some fairly non-maintainable hacks).
make_hlds.m, unify_proc.m:
Import special_pred.m.
quantification.m:
Make implicit quantification rename apart vars that
are local to distinct scopes. This will help in the
singleton variable warning pass once the latter has
been changed to work on the HLDS.
These changes also allow goals of the form:
.... X ....,
some [X] Goal
which were previously not allowed.
cse_detection.m:
A 1 line bugfix from Zoltan.
det_analysis.m:
Rather than redoing quantification, construct
a correct goal_info directly in det__disj_to_ite/3.
optimize.pp:
Fix a singleton variable. Zoltan, there is an
XXX for you to read and remove if the fix is
correct.
common.m, cse_detection.m, det_analysis.m,
follow_code.m, make_hlds.m, polymorphism.m,
unify_proc.m:
Fix the calls to implicitly_quantify_clause_body and
implicity_quantify_goal.
TODO:
Update a couple of things.
parser.m:
Add a map(string, var) to the state so that varset
can be simplified.
varset.m:
Simplfy the varset structure so that the binding
of names to variables is cheaper.
modes.m, mode_errors.m, mode_util.m:
Finish implementing mode checking of lambda expressions.
inst_match.m:
Mode checking of higher-order pred modes was slightly
too strict - relax it a little.
modes.m, mode_errors.m, mode_info.m:
For mode errors that occur in predicate calls,
record the argument number that they occurred in,
and print it out in mode error messages.
(This also fixes a bug where some of the determinism
error messages would say "in argument 0 of call to pred ...").
polymorphism.m:
A couple of minor simplifications.
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.
This set of changes includes most of the work necessary for
mode and determinism checking of higher-order predicates.
prog_io.m:
Change the syntax for lambda expressions: they need
to have a determinism declaration. Lambda
expressions must now look like this:
lambda([X::in, Y::out] is det, ...goal...).
^^^^^^
Note that both the modes and the determinism are mandatory,
not optional.
hlds.m:
Insert a determinism field in the lambda_goal structure.
hlds_out.m, inlining.m, make_hlds.m, modes.m, polymorphism.m, quantification.m,
switch_detection.m, typecheck.m:
Modified to use lambda_goal/4 rather than lambda_goal/3.
prog_io.m:
Add a new field to the `ground' inst, of type `maybe(pred_inst_info)'.
We use this to store the modes and determinism of higher-order
predicate terms.
code_info.m, inst_match.m, mercury_to_mercury.m, mode_util.m, modes.m,
polymorphism.m, shapes.m, undef_modes.m:
Modified to handle higher-order pred modes:
use ground/2 rather than ground/1.
(Note that modes.m still requires a bit more work on this.)
llds.m:
Add a new field to the call_closure/3 instruction to hold the
caller address for use with profiling, since the C macros
require a caller address.
dup_elim.m, frame_opt.m, garbage_out.m, live_map.m, middle_rec.m, opt_debug.m,
opt_util.m, value_number.m, vn_*.m:
Modified to use call_closure/4 rather than call_closure/3.
mercury_to_mercury.m:
Export mercury_output_det for use by hlds_out.m.
Lambda expressions now work, and you can now use polymorphic predicates
as higher-order pred terms. (Mode checking and determinism checking
are still not implemented, and the modes of call/N are very restrictive.
But these change makes solutions/2 a lot more useful now.)
hlds.m:
Comment out the stuff for recording num_warnings, since it
wasn't being used. Instead we now use that slot in the
module_info for a counter which holds a number to use to
name the predicates for lambda expressions. Add a new
predicate module_info_next_lambda_count/3 to get and
increment this counter.
modes.m:
Transform higher-order pred constants into lambda expressions.
(Also, use slightly more meaningful variable names in a few places.)
polymorphism.m:
Use module_info_next_lambda_count/3 to name the predicates
created for lambda expressions.
code_util.m:
Handle __LambdaGoal__ labels correctly.
quantification.m:
Fix ANOTHER bug in quantification of lambda expressions.
hlds_out.m:
Fix minor indentation problem in output of lambda expressions.
polymorphism.m:
When a lambda expression is encountered, convert it into a
new predicate. (Works OK, with one caveat: you can currently
only have one lambda expression per program.)
make_hlds.m:
Export a couple of predicates so that polymorphism.m can use
them when it is creating new predicates for lambda expressions.
modes.m:
Fix a problem with quantification of lambda goals.
Add some code to convert higher order predicate calls into
lambda expressions so that they get mode checked and
polymorphism-processed properly. (Unfinished, code
commented out.)
hlds.m:
Simplify the code for goal_info__remove_feature.
polymorphism.m:
Optimize calls to special predicates compare/3 and index/2
for which the type is known at compile time: generate a
direct call to the special predicate for that type, rather
than generating code to create a type_info and then call
the general version to dispatch on the type_info.
hlds.m, make_hlds.m:
A couple of minor changes as part of above change.
-------------------------------------------------------
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.
context of the unification from which call was made. We we use this to generate
significantly better error messages. (There should be no more messages of the
form "call to __Unify__(blah blah blah) can fail".) Most of the files are
changed just to reflect this.
An unrelated change in det_analysis is that we now ensure the absence of
cycles by modifying the new inferred determinism in the light of the old
one, ensuring that any changes are monotonic.
In hlds_out, inhibit the printing of pseudo-imported predicates (unifications)
since nobody cares about them except sometimes Fergus.
unifications. See the comments at the top of unify_proc.m for
details of how it's done.
hlds.m:
Add new export statuses `pseudo_imported' and `pseudo_exported'
to handle unification predicates, which can now have complicated
modes.
code_gen.pp, code_info.m, common.m, constraint.m, cse_detection.m,
follow_code.m, follow_vars.m, hlds_out.m, inlining.m, live_vars,
make_hlds.m, mercury_compile.pp, modes.m, store_alloc.m,
switch_detection.m:
Handle pseudo_imported predicates.
modes.m, constraint.m:
Change modecheck to return an updated module_info, since
modechecking may insert new entries into the unify_requests
queue in the module_info. Make sure that modechecking
never inserts requests into the unify_requests queue
for code that has mode errors (or needs rescheduling).
call_gen.m, polymorphism.m:
Move duplicated code into unify_proc.m.
clause_to_proc.m:
Add new predicate clauses_to_proc for use by unify_proc.m.
unify_proc.m:
Implement complicated unifications with complicated modes.
hlds.m and lots of other files:
Change the type of the first two arguments of unify/5 in
hlds__goal_expr from `term, term' to `var, unify_rhs'
where unify_rhs is given by
:- type unify_rhs
---> var(var)
; functor(const, list(var))
; lambda_goal(list(var), hlds__goal).
This change was for two reasons: firstly, it simplifies the
code in a lot of places, and secondly, it is a step towards
implementing lambda closures and higher-order predicates
properly.
modes.m, typecheck.m, code_util.m:
Don't report a compile error if there is a higher-order pred
unification in a compiler-generated predicate. (Instead, delay
the error until run-time so that it only occurs if the higher-order
pred unification in question actually gets executed.)
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)'.
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!!!)
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.
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 )
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.
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.
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.