Like type-checking, this means that a large class of errors are detected at compile time. Mercury has a strong determinism system. If it cannot do so, it rejects the program. As with types and modes, determinism checking catches many program errors at compile time. Mercury has a module system.
Programs consist of one or more modules.
Each module has an interface section that contains the declarations for the types and predicates exported from the module, and an implementation section that contains the definitions of the exported entities and also definitions for types and predicates that are local to the module. For predicates that are not exported, Mercury supports automatic determinism inference. Strong types, modes, and determinism provide the compiler with the information it needs to generate very efficient code. The Mercury compiler is written in Mercury itself. It was bootstrapped using NU-Prolog and SICStus Prolog.