Mercury (programming language)

Mercury is a highly ajar to Prolog programming language. It combines elements from the functional and logic programming. The first version was developed by Fergus Henderson, Thomas Conway, and Zoltan Somogyi and published on 8 April 1995.

Mercury is a " purer " and thus falls more declarative language Prolog, because, in contrast to Prolog has no " non-logical " properties, such as the cut operator ( a Prolog construct backtracking prevented) or imperative input and output. This makes the programming of sequential algorithms a bit unwieldy, but facilitates the optimization of programs. This enables significantly faster code be generated than is possible with Prolog.

Mercury has several features for better software engineering, it is compiled rather than interpreted, as is usual in logic programming, and implemented an advanced, strict type - and mode system. The authors claim that these properties, together with the abstract nature of logic programming, accelerated the production of reliable programs. Mercury's module system allows the division into self-contained units, which in the past has been a problem of logic programming. (Although some Prolog implementations also introduced a module system. ) Input and output is implemented by Uniqueness types.

Mercury has several backends such as "low-level C" ( the original Mercury back-end ), "high-level C", Microsoft IL for. NET, Sun's JVM and assembler using the gcc backend, the last three backends currently do not have alpha or beta status. Mercury is being developed at the University of Melbourne under the direction of Zoltan Somogyi and is also available for Microsoft Windows for most Unix platforms, Mac OS X and using Cygwin and MinGW.

Hello World in Mercury:

: - Module hello.  : - Interface.  : - Import_module io.  : - Pred main ( io.state, io.state ).  : - Mode main ( di, uo ) is det.  : - Implementation.   main ( IO! ): -          io.write_string ("Hello, World! \ n",! IO). (after Ralph Becket Mercury tutorial, PDF, 239 kB).

564562
de