[mercury-users] syntax across languages

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Jun 2 16:22:03 AEST 2002


On 01-Jun-2002, Pixel <pixel at mandrakesoft.com> wrote:
> More specifically, about Mercury:
> 
> http://merd.net/pixel/language-study/syntax-across-languages-per-language/Mercury.html
> 
> Would someone be so kind to give me some/the missing entries? :-)

Here's a few.

Commenting:
	multi-line comments (not nestable): /* ... */
	single-line comments: % ... <newline>

Comparison: < > =< =>
Comparison (returns 3 values): compare
Force garbage collection: garbage_collect

Function call: f(X)
Function call (with no parameter): f
Function declaration:
	:- func f(int) = int.
	f(X) = ...

	(Note: you need to learn the difference between
	function declaration and function definition.
	Your entry for "C" is a function definition, not
	a function declaration.  I've done the same for Mercury.)

Control flow:
	If-then-else: two different syntaxes:
		(if ... then ... else ...)
	or      (... -> ... ; ...)

	Multiple selection: two different syntaxes.
		(1) multiple clauses:

		foo(positive) = ...
		foo(negative) = ...
		foo(zero) = ...

		(2) disjunctions:

		( X = positive, ...
		; X = negative, ...
		; X = zero, ...
		)


-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list