Mercury is a functional logic programming language geared towards real-world applications. It is developed at the University Of Melbourne Computer Science department under the supervision of Zoltan Somogyi. The first version was developed by Fergus Henderson, Thomas Conway and Zoltan Somogyi and was released on April 8, 1995.
Mercury is a purely declarative logic language. It is related to both Prolog and Haskell. It features a strong, static, polymorphic type system, as well as a strong mode and determinism system.
The official implementation, the Melbourne Mercury Compiler is available for most Unix platforms, including Mac OS X, as well as for Microsoft Windows (in Windows, it requires one of the Cygwin or MinGW toolsets, and can be compiled either with GCC or Microsoft Visual C++).
Mercury is based on the logic programming language Prolog. It has the same syntax, and the same basic concepts such as the SLD resolution algorithm. It can ostensibly be viewed as a pure subset of Prolog with strong types and modes. As such, it is often compared to its predecessor, both in terms of features, and run-time efficiency.
The language is designed with software engineering principles in mind. Unlike the original implementations of Prolog, it has a separate compilation phase, rather than being directly interpreted, which allows a much wider range of errors to be caught before running a program. (Modern versions of Prolog normally support compilation as well as providing an interpreter. An executable produced by a modern Prolog compiler can also be very efficient.) It features a sophisticated, strict type and mode system, which its authors claim makes it much easier to write robust software. Mercury's module system enables division into self-contained units, a problem for past logic programming languages. (But note that several Prolog implementations now also support modules.)
Full article ▸