Files
mercury/samples
Julien Fischer 190b69d4f1 Add a new command line option that causes the compiler to print out the
set of flags that it passes to the linker in order to link against a
selected set of Mercury libraries (the standard libraries plus any others
specified via the --ml option) in the current grade.
This removes the need for using the ml script with standalone interfaces.
(Which is useful on those systems that don't have a proper shell and can't
use that script!)

compiler/compiler_target_code.m:
	Add a predicate that prints out the above information.

	Refactor code in order to to avoid duplication between the new
	functionality and the existing code for invoking the linker.

compiler/mercury_compile.m:
compiler/options.m:
	Add the new option.

doc/user_guide.texi:
	Add an entry for the new option.

samples/c_interface/standalone_c/Makefile:
	Query the compiler directly about what flags to pass to the linker
	rather than using the ml script.

	Query the compiler about what flags to pass to the C compiler as
	well.  (This was implemented a while ago, but this example was
	never updated.)

	Extend this example to optionally work with shared libraries.
2009-01-20 06:24:05 +00:00
..
2008-03-04 04:41:05 +00:00
2008-04-04 03:58:44 +00:00

This directory contains some example Mercury programs.

hello.m			"Hello World" in Mercury.

cat.m                   An implementation of a simple version of the
			standard UNIX filter `cat', which just copies
			its input files or the standard input stream to
			the standard output stream.

sort.m                  An implementation of a simple version of the
			standard UNIX filter `sort', which reads lines
			from its input files or the standard input
			stream, sorts them, and then writes the result
			to the standard output stream.

calculator.m            A simple four-function arithmetic calculator,
			with a parser written using the Definite Clause
			Grammar notation.

calculator2.m		A simple four-function arithmetic calculator,
			which uses the parser module in the standard
			library with a user-defined operator precedence
			table.

committed_choice.m	An example illustrating committed-choice
			nondeterminism in Mercury.

interpreter.m		An simple interpreter for definite logic programs.
			A demonstration of meta-programming in Mercury.

expand_terms.m		Another example meta-program, showing how to
			emulate Prolog's `expand_term' mechanism.

e.m			A small program which calculates the base of
			natural logarithms to however many digits you
			choose.  It illustrates one way to achieve
			lazy evaluation in Mercury.

Mmakefile		The file used by `mmake', the Mercury Make program,
			to build the programs in this directory.

The `solutions' sub-directory contains some examples of the use of
nondeterminism, showing how a Mercury program can compute 
	- one solution,
	- all solutions, or
	- some solutions (determined by a user-specified criteria)
for a query which has more than one logically correct answer.

There are also some sub-directories which contain examples of multi-module
Mercury programs:

diff                    This directory contains an implementation of a
			simple version of the standard UNIX utility
			`diff', which prints the differences between
			two files.

c_interface		This directory contains some examples of mixed
			Mercury/C/C++/Fortran programs using the C interface.

rot13			This directory contains a few implementations of
			rot-13 encoding.

muz			This directory contains a syntax checker / type checker
			for the specification language Z.

solver_types		This directory contains an example solver type
			implementation and some sample applications.