Mercury語言

維基百科,自由的百科全書
(重新導向自墨丘利语言
Mercury
編程範型邏輯, 函數式, 面向對象
設計者Zoltan Somogyi
實作者墨爾本大學
釋出時間1995年4月8日,​28年前​(1995-04-08
當前版本
  • 22.01.8 (2023年9月8日;穩定版本)[1]
編輯維基數據鏈接
型態系統強類型, 靜態, 多態
實作語言Mercury
系統平台IA-32, x86-64, ARM, Sparc64, Java, CLI, Erlang/OTP
作業系統跨平台: Unix, Linux, macOS, Solaris, FreeBSD, OpenBSD, Windows, Android
許可證GPL編譯器,
LGPL標準庫
文件擴展名.m
網站www.mercurylang.org
主要實作產品
Melbourne Mercury Compiler
啟發語言
Prolog, Hope, Haskell

Mercury是為現實世界使用而開發的函數式邏輯編程語言。最初版本是墨爾本大學計算機科學系的Fergus Henderson、Thomas Conway和Zoltan Somogyi在Somogyi監督下完成的,並在1995年4月8日發行。

Mercury是純聲明式邏輯編程語言。它有關於PrologHaskell二者[2]。它的特徵是有強、靜態、多態類型系統,和強的模態(mode)和確定性系統。

官方實現是墨爾本Mercury編譯器,可以在多數Unix類Unix平台上獲得到,包括LinuxmacOSWindows

語法[編輯]

Hello World 程序[編輯]

下面是"Hello World"

:- module hello.
 
:- interface.
 
:- import_module io.
 
:- pred main(io::di, io::uo) is det.
 
:- implementation.
 
main(!IO) :-
    io.write_string("世界,你好!\n", !IO).

引用[編輯]

  1. ^ Release 22.01.8. 2023年9月8日 [2023年9月18日]. 
  2. ^ The Mercury Project - Motivation. [2021-02-10]. (原始內容存檔於2021-02-15). 

外部連結[編輯]