This file documents the Mercury implementation, version rotd-2025-08-04.
Copyright © 1995–2012 The University of Melbourne.
Copyright © 2013–2025 The Mercury team.
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
This guide describes the compilation environment of Mercury — how to build and debug Mercury programs.
This guide is currently undergoing extensive modifications, which means that some parts, particularly the ones that contain ZZZ markers, are not in state that is ready to be consumed. These modifications started on 2025 July 27, and will probably continue for around two weeks. During that time, we advise you to look at earlier versions of this guide.
• Introduction | General overview. | |
• Introduction to mmc | Introduction to compiling Mercury program | |
• Mercury grades | Mercury grades | |
• Running | Running Mercury programs | |
• Compilation details | The Mercury compilation process in detail | |
• Filenames | File naming conventions. | |
• Using Mmake | “Mercury Make”, a tool for building Mercury programs. | |
• Libraries | Creating and using libraries of Mercury modules. | |
• Debugging | The Mercury debugger ‘mdb’. | |
• Profiling | Analyzing the performance of Mercury programs. | |
• Invocation | List of options for the Mercury compiler. | |
• Environment | Environment variables used by the compiler and utilities. | |
• Diagnostic output | Controlling some aspects of compiler diagnostics. | |
• C compilers | How to use a C compiler other than GNU C. | |
• Foreign language interface | Interfacing to other programming languages from Mercury. | |
• Stand-alone interfaces | Calling procedures in Mercury libraries from programs written in other languages. | |
• Index |