samples/mcowsay.m:
A Mercury version of the cowsay program. It serves an more extended
example (but still small) example of how to write command line
utilities in Mercury.
samples/README.md:
Include the new sample.
samples/Mmakefile:
Include the new sample.
Put the list of sample programs in alphabetical order.
The main objective of this change is to get bootchecks in the csharp
and java grades to actually build the slice, profiler, deep_profiler
and mfilterjavac directories, which (due to the bug this diff fixes)
they weren't doing before.
However, since one side effect of this change is to eliminate
one source of annoying warnings from mmake about references to undefined
variables, a subsidiary objective is to eliminate other sources of such
warnings as well, which mostly come from the rules for making tags files.
browser/Mmakefile:
deep_profiler/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
When creating stage 3, the bootcheck builds, in each directory,
only the files that it wants to compare against their stage 2 versions.
This means that it wants to build all the .c, .cs or .java files,
which it does via the cs, css and javas mmake targets.
The correct definitions of the rules of these targets depends on
whether mmc --make is being used or not, so we need at least two
sets of definitions: one for mmc --make, and for no mmc --make,
and conditionally selecting the appropriate one. The latter definition
has the problem that it refers to mmake variables that are intended
to be defined in .dv files created by mmc --generate-dependencies,
but until that has been run, those mmake variables are undefined.
Until now, the only directories that had both the mmc --make
and the no mmc --make definitions were the ones needed to build
the compiler. Bootchecks in the csharp and java grades, which
always use --make make, got errors when they tried to build
the directories that bootcheck builds after the compiler:
the slice, profiler, deep_prof and mfilterjavac directories.
This diff ensures that all directories we build in bootcheck
get all both versions of the os, cs, css, and javas targets.
In fact, they get two subversions of the no mmc --make version:
one for use in the presence of .dv files, and one for use in their
absence. The latter just builds the .dv files and invokes mmake
again. This avoids one source of warnings about undefined mmake
variables.
To avoid another source, make the rules for tags files and their
proxies depends on *.m instead of mmake variables such as $(mcov.ms),
since this makes sense even before making dependencies. The only price
is that any untracked Mercury source files in the directory have to
either be given some other suffix, or moved somewhere else.
Where relevant, make the mtags invocation prefer the master versions
of files that are copied from the mdbcomp directory to other directories,
since this is the only writeable version.
Make the os and cs rules consistently NOT build the _init.[co] files.
The way we use those files in bootcheck, we never need them;
when we need them, the right target to give is the executable anyway.
In the slice directory, don't put mcov between mtc_union and mtc_diff.
Eliminate unnecessary duplication, e.g. of sources in rules.
Eliminate double negatives in conditionals.
Fix formatting.
Mmake.common.in:
bindist/Mmakefile:
bytecode/Mmakefile:
compiler/Mmakefile:
doc/Mmakefile:
grade_lib/Mmakefile:
robdd/Mmakefile:
samples/Mmakefile:
scripts/Mmakefile:
tools/Mmakefile:
trace/Mmakefile:
util/Mmakefile:
Add "ft=make" to vim modelines. This is redundant for the files whose
names is Mmakefile, but it is needed for Mmake.common.
samples/Mmakefile:
Add the beer program to list of targets.
samples/*.m:
Convert (C->T;E) to (if C then T else E).
Delete trailing whitespace.
Use predmode syntax instead of separate pred and mode
declarations.
samples/interpreter.m:
Fix up one predicate that had some clauses that used
DCGs and others that used state variables.
Don't use the name 'IO' for something that isn't the I/O state.
samples/diff/*.m:
samples/c_interface/c_calls_mercury/mercury_main.m:
samples/c_interface/short_example.m:
Delete trailing whitespace.
This file-specific setting will override a default setting of expandtabs
in $HOME/.vimrc.
*/Makefile:
*/Mmakefile:
As above.
tests/hard_coded/.gitignore:
Don't ignore the purity subdir. This ignore must have been left over
from when purity.m was a test in hard_coded, not hard_coded/purity,
and it ignored an executable, not a directory.
Estimated hours taken: 4
Allow user-defined operator precedence tables for parser__read_term
and term_io__write_term.
library/ops.m:
Define a typeclass `op_table' with methods for accessing
operator precedence tables.
Define a type `ops__mercury_op_table', representing the
standard Mercury operator table.
Make `ops__mercury_op_table' an instance of `op_table'.
Define `ops__table' as equivalent to `ops__mercury_op_table'
(it's obsolete, but we can't mark types as obsolete).
Rename `ops__init_op_table' as `ops__init_mercury_op_table',
mark ops__init_op_table as obsolete
library/parser.m:
library/term_io.m:
Add variants of `parser__read_term' and `term_io__write_term'
which take an operator precedence table.
Don't hard-code the maximum priority and argument priority.
Use the `op_table' methods to find those.
Make the priority of operator terms (X `op` Y) 1, not 100.
The reference manual states that operator terms have
the highest precedence possible.
This change slows down a program which does nothing but
parse terms by a bit under 5%, less for writing.
library/hash_table.m:
Fix a few places where parentheses are required because
operator terms now have the lowest possible priority.
`rem' is an operator -- it doesn't need backquotes.
compiler/mercury_to_mercury.m:
library/io.m:
Rename `ops__init_op_table' to `ops__init_mercury_op_table'.
Pass the `op_table' to `ops__max_priority'.
NEWS:
doc/reference_manual.texi:
Document the changes.
Add operator terms to the operator table.
In the "Terms" section of the reference manual, use the same
terminology to describe operator terms as is used in the
"Builtin Operators" section.
samples/Mmakefile:
samples/README:
samples/calculator2.m:
An example program.
tests/hard_coded/term_io_test.exp:
tests/invalid/func_errors.err_exp:
tests/invalid/inst_list_dup.err_exp:
tests/invalid/predmode.err_exp:
tests/invalid/some_err.exp:
`term_io__write_term' now has the same argument priority
behaviour as `parser__read_term', so remove some unnecessary
parentheses from the output.
Estimated hours taken: 3
Added a new sample program, e.m, and fixed some out-of-date
documentation.
samples/Mmakefile:
samples/e.m:
Sample program 'e' which calculates the base of natural
logarithms to lots of digits (if you're prepared to wait).
samples/README:
Added documentation for e.m, updated documentation for
samples/diff/* to reflect recent changes.