The Mercury logic programming system.
Mercury C HTML Makefile M4 Shell Other
Switch branches/tags
version-14_01_1 version-14_01 version-13_05_2 version-13_05_1 version-13_05 version-12_08-branchpoint version-12_08-GIT version-11_07_2 version-11_07_1 version-11_07 version-11_07-branchpoint version-11_01 version-11_01-branchpoint version-10_04_2 version-10_04_1 version-10_04 version-10_04-branchpoint version-0_13_1 version-0_13-branchpoint version-0_12_2 version-0_12_1 version-0_12-branchpoint version-0_11_0 version-0_11-branchpoint version-0_10 version-0_9_1 version-0_9 version-0_9_x-snapshot version-0_9_x-snapshot-19991220 unstable-version-0_13_1-x86_64-unknown-linux-gnu-libc2_3 unstable-version-0_13_1-i686-pc-linux-libc2_3-gnu-O5-intermod unstable-version-0_13-branch-x86_64-unknown-linux-gnu-libc2_3 unstable-version-0_13-branch-i686-pc-linux-libc2_3-gnu-O5-intermod unstable-version-0_12_2-i686-pc-linux-libc2_2-gnu-O5-intermod unstable-version-0_12_2-i386-pc-solaris2_8 unstable-version-0_12_1-i686-pc-linux-libc2_3-gnu-O4-intermod unstable-version-0_12_1-i686-pc-linux-libc2_3-gnu-O2 unstable-version-0_12_1-i686-pc-linux-libc2_2-gnu-O5-intermod unstable-version-0_12_1-i386-pc-solaris2_8 unstable-version-0_12-branch-i686-pc-linux-libc2_3-gnu-O5 unstable-version-0_12-branch-i686-pc-linux-libc2_3-gnu-O4-intermod unstable-version-0_12-branch-i686-pc-linux-libc2_3-gnu-O4-hlc unstable-version-0_12-branch-i686-pc-linux-libc2_3-gnu-O2 unstable-version-0_12-branch-i686-pc-linux-libc2_2-gnu-O5 unstable-version-0_12-branch-i686-pc-linux-libc2_2-gnu-O5-intermod unstable-version-0_12-branch-i686-pc-linux-libc2_2-gnu-O3 unstable-version-0_12-branch-i386-pc-solaris2_8 unstable-version-0_11_0-sparc-sun-solaris2_7 unstable-version-0_11_0-i686-pc-linux-libc2_3-gnu-O5-intermod unstable-version-0_11_0-i686-pc-linux-libc2_2-gnu-O5 unstable-version-0_11_0-i686-pc-linux-libc2_2-gnu-O5-lcc unstable-version-0_11_0-i686-pc-linux-libc2_2-gnu-O5-hlc unstable-version-0_11_0-i686-pc-linux-libc2_1-gnu-O4 unstable-version-0_11_0-i686-pc-linux-libc2_1-gnu-O4-asm unstable-version-0_11_0-i686-pc-linux-libc2_1-gnu-O3 unstable-version-0_11_0-i386-pc-solaris2_8 unstable-version-0_11-branch-i686-pc-linux-libc2_3-gnu-O5-intermod unstable-version-0_11-branch-i686-pc-linux-libc2_2-gnu-O5-intermod unstable-version-0_11-branch-i686-pc-linux-libc2_2-gnu-O5-hlc unstable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5 unstable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5-lcc unstable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5-intermod unstable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5-hlc unstable-version-0_11-branch-alpha-dec-osf5_1 unstable-version-0_10_y-sparc-sun-solaris2_7 unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O5 unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O5-lcc unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O5-intermod unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O5-hlc unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O4 unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O4-hlc unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O2 unstable-version-0_10_y-i586-pc-linux-libc2_1-gnu-O0 unstable-version-0_10_y-alpha-dec-osf5_1 unstable-version-0_10_y-alpha-dec-osf3_2 unstable-version-0_10_x-sparc-sun-solaris2_7 unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O5 unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O5-lcc unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O4 unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O4-hlc unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O3 unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O2 unstable-version-0_10_x-i586-pc-linux-libc2_1-gnu-O0 unstable-version-0_10_x-alpha-dec-osf3_2 termination2_trunk stable-version-0_11_0-i686-pc-linux-libc2_3-gnu-O5-intermod stable-version-0_11_0-i686-pc-linux-libc2_2-gnu-O5 stable-version-0_11_0-i686-pc-linux-libc2_2-gnu-O5-lcc stable-version-0_11_0-i686-pc-linux-libc2_2-gnu-O5-hlc stable-version-0_11_0-i686-pc-linux-libc2_1-gnu-O4 stable-version-0_11_0-i686-pc-linux-libc2_1-gnu-O4-asm stable-version-0_11_0-i686-pc-linux-libc2_1-gnu-O3 stable-version-0_11-branch-i686-pc-linux-libc2_3-gnu-O5-intermod stable-version-0_11-branch-i686-pc-linux-libc2_2-gnu-O5-lcc stable-version-0_11-branch-i686-pc-linux-libc2_2-gnu-O5-intermod stable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5 stable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5-lcc stable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5-intermod stable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5-hlc stable-version-0_11-branch-alpha-dec-osf5_1
Nothing to show
Latest commit 47f1df4 Jul 22, 2017 @zsomogyi zsomogyi Split mlds_data_defn into three separate types.
We used to use mlds_data_defns to represent three related but nevertheless
distinct kinds of entities: global variables, local variables, and fields
in classes. This diff replaces the mlds_data_defn type with three separate
types: mlds_global_var_defn, mlds_local_var_defn and mlds_field_var_defn
respectively, with corresponding changes to related types, such as

The global variables are completely separate from the other two kinds.
Local and field variables are *mostly* separate from each other, but they
are related in one way. When we flatten out nested functions, the child
nested function can no longer access its parent function's local variables,
so we pass those variables to it as fields of an environment structure.
This requires turning local variables to fields of that structure,
and the code in the flattened previously-nested function that accesses
those fields naturally wants to treat them as if they were local variables
(as indeed they sort-of were before the flattening). There are therefore
ways to convert each of local and fields vars into the other.

This restructuring makes clear several invariants of the MLDS we generate
that were previously hidden. For example, variables with certain kinds of
names (in the before-this-diff, general version of the mlds_var_name type)
could appear only as function arguments or as locals in ml_stmt_blocks,
not in ml_global_data, while for some other names the opposite was the case.
And in several cases, functions used to take a general mlds_data_defn
as argument but aborted if given the "wrong kind" of mlds_data_defn.

This diff also makes possible further simplifications. For example,
local vars should not need some flags (since e.g. they are never per-instance),
and should never need either module or type qualification, while global
variables (which are also never per-instance) should never need type
qualification (since they are not fields of a type). The definitions
in blocks should consist of local variables and (before flattening) functions,
not global variables, field variables or classes, while the members in classes
should be only field variables and functions (and maybe classes), not
global or local variables. Those changes will be in future diffs;
this is already large enough.

    Make the changes described above.

    Use tighter types where possible.

    Use (a generalized version) of the mlconst_named_const functor
    to represent values of enum types defined in the runtimes
    of the target platforms.

    Store *only* global variables in fields that previously stored general
    mlds_datas (that by design were always global).

    Store *only* closure wrapper functions in the previous non-flat-defns
    field. Before this diff, the code generator only put closure wrapper
    functions in this field, but then ml_elim_nested.m put everything
    resulting from the expansion of those functions back into those fields
    as well, some of which were not functions. It now puts those non-function
    things into the MLDS data structure directly.

    Conform to the changes above.

    Use tighter types where possible. If appropriate, change the name
    of the function or predicate accordingly.

    Represent references to enum constants defined in the runtime of the
    target language as named constants (since they is what they are),
    instead of representing them as MLDS "variables", which required
    the code of mlds_to_cs.m had to special-case the treatment
    of those "variables".

    Conform to the changes above.

    Use tighter types where possible.

    Don't put the environment types resulting from flattening nested scopes
    back into the non-flat-defns slot of the ml_elim_info; instead, return
    them separately to code that puts them directly in the MLDS.

    When returning the names of enum constants in the C runtime, return also
    the prefixes that you need to place in front of these to obtain their names
    in the Java and C# runtimes.

    Conform to the changes above.

    Move a utility function from ml_util.m to mlds_to_target_util.m,
    since it is used only in mlds_to_*.m.
Failed to load latest commit information.
benchmarks Update code in benchmarks. Apr 26, 2016
bindist Copyright notices for 2017. Jan 2, 2017
boehm_gc @ 81ac175 Update boehm_gc submodule. Oct 13, 2016
browser Fix more warnings from --warn-inconsistent-pred-order-clauses. Apr 29, 2017
bytecode Remove .cvsignore files Apr 4, 2017
compiler Split mlds_data_defn into three separate types. Jul 21, 2017
deep_profiler Add builtin 8, 16 and 32 bit integer types -- Part 1. Jul 17, 2017
doc Add builtin 8, 16 and 32 bit integer types -- Part 1. Jul 17, 2017
extras Fix comments in extras/gmp_int. May 7, 2017
grade_lib Add field names to grade_vars. Apr 25, 2016
java/runtime Add a builtin unsigned word sized integer type -- Part 1. Oct 24, 2016
library Add builtin 8, 16 and 32 bit integer types -- Part 1. Jul 17, 2017
m4 Bump the minimum version of Java required. Oct 10, 2016
mdbcomp Add builtin 8, 16 and 32 bit integer types -- Part 1. Jul 17, 2017
mfilterjavac Make --warn-unused-imports the default for the Mercury system. Jan 18, 2017
profiler Make --warn-unused-imports the default for the Mercury system. Jan 18, 2017
robdd Shut up some warnings in the robdd directory. Sep 1, 2015
runtime Fix a typo. Jul 18, 2017
samples Generalise the representation of integers in the term module. Apr 22, 2017
scripts Don't get confused by ';'s in end-of-line comments. Apr 6, 2017
slice Make --warn-unused-imports the default for the Mercury system. Jan 18, 2017
ssdb Make --warn-unused-imports the default for the Mercury system. Jan 18, 2017
tests Implicitly rename apart vars occurring only in trace goals. Jul 3, 2017
tools Add tools for checking Java and C# output. Jul 13, 2017
trace Copyright notices for 2017. Jan 2, 2017
util Delete unnecessary foreign_exported procedures. Sep 28, 2016
vim Highlight more C keywords in vim. Jan 30, 2017 Improve the robustness of the INSTALL scripts. Apr 21, 2017 Copyright notices for 2017. Jan 2, 2017
.gitignore [net] Impement a Mercury interface to getaddrinfo Apr 7, 2015
.gitmodules Upgrade Boehm GC to 7.6.0 Sep 22, 2016
.nocopyright Add mercury.snk to .nocopyright. Nov 22, 2012
BUGS Update email addresses and URLs. Apr 24, 2013
COPYING Added a copy of the GPL. Mar 20, 1995
COPYING.LIB Update the README file, and add the LGPL to the CVS archive. Mar 28, 1995
HISTORY Move 13.05.X NEWS into HISTORY. Jan 7, 2014
INSTALL.git Improve the robustness of the INSTALL scripts. Apr 21, 2017
LIMITATIONS Clearly explain what part of partial instantiation isn't supported. Mar 18, 2014
Makefile Tell vim not to expand tabs in Makefiles. Jan 8, 2015
Makefile.DLLs Introduce two new directories, trace and browser, containing libraries Sep 29, 1998 Support building with AddressSanitizer and UndefinedBehaviorSanitizer. Oct 13, 2016
Mmake.workspace Fix some minor make annoyances. Aug 25, 2015
Mmakefile Improve the robustness of the INSTALL scripts. Apr 21, 2017
NEWS Report solver/nosolver conflicts for all type definitions. Jun 28, 2017
README.AIX Fix and update README files. Jan 5, 2015
README.CSharp Update README files for non-C backends. Feb 18, 2016
README.Cygwin Fix and update README files. Jan 5, 2015
README.Erlang Update status of Erlang backend. Sep 28, 2016
README.FreeBSD Shared libraries work on FreeBSD. Oct 18, 2015
README.HPUX Minor rewording of README.{AIX,HPUX}. Jun 16, 2014
README.Java Bump the minimum version of Java required. Oct 10, 2016
README.Linux Remove documentation for --cross-compiling option. Mar 27, 2015
README.Linux-Alpha Move the patch for making the GNU assembler into the configuration sc… Dec 22, 1998
README.Linux-PPC Fix spelling and double up words. Jul 14, 2010
README.Linux-m68k Port to Linux-m68k. A lot of this work was done by Roman Hodek, Oct 2, 1998
README.MS-VisualC Fix and update README files. Jan 5, 2015
README.MS-Windows Add instructions for MSYS2 environment with MinGW-w64. Aug 31, 2015
README.MacOS Make mdb interactive queries work on OS X. Aug 21, 2015
README.MinGW Fix a spelling error in README.MinGW: Sep 3, 2015
README.MinGW-cross Fix instructions for finishing cross-compiler installation. Oct 18, 2015
README.Solaris Merge late changes from the 0.13 branch onto the main branch. Sep 15, 2006
README.ThreadScope Make a note that ThreadScope support is currently broken. May 5, 2013
README.bootstrap Update instructions for building from git. Mar 31, 2016
README.clang Mention that Mercury works with clang on Windows. Oct 3, 2011 Fix an incomplete sentence in Jan 5, 2015
README.sanitizers Support building with AddressSanitizer and UndefinedBehaviorSanitizer. Oct 13, 2016
README.ssdebug Add option --ssdb-trace which allows one to control which modules are… Jul 19, 2012
RELEASE_NOTES Fix some minor errors in the release notes. Jan 4, 2015
RESERVED_MACRO_NAMES Remove support for the MPS garbage collector. Aug 5, 2014
VERSION Revert my earlier change to VERSION Jan 3, 2014
config.guess Update config.guess and config.sub. Aug 31, 2015
config.sub Update config.guess and config.sub. Aug 31, 2015 Add builtin 8, 16 and 32 bit integer types -- Part 1. Jul 17, 2017
install-sh Use an autoconf-generated configure script rather than manual configu… May 12, 1995
mercury.snk Sign the all the assemblies in the csharp grade. Nov 22, 2012 Use nested submodules to include boehm_gc/libatomic_ops Oct 19, 2015


Mercury is a logic/functional programming language which combines the clarity and the expressiveness of declarative programming with advanced static analysis and error detection features.

More information is available on the website's about pages, in other README files in the source code repository, and in the documentation.

README files

The Mercury compiler has a number of different backends and works on different operating systems. Specific information is contained in individual README files:

Other information

See the current release notes for the latest stable release. The history file is relevant if you want to find out more about the past development of Mercury. News lists any current or future enhancements (but this isn't always up-to-date). The limitations file lists a number of ways in which the Mercury implementation does not yet meet its goals.

Information for developers

If you are considering contributing to the Mercury project the website contains some documents that may be helpful. These include a document about contributions in general and specific information about contributing such as coding styles.


See our contact page.