1256:
125:
45:
459:, but it can make certain programming constructs (such as a switch over a number of options, with a default) harder to express. While Mercury does allow impure functionality, it serves mainly as a way to call foreign language code. All impure code must be explicitly marked. Operations which would typically be impure (such as
420:
By using information obtained at compile time (such as type and mode), programs written in
Mercury typically perform significantly faster than equivalent programs written in Prolog. Its authors claim that Mercury is the fastest logic language in the world, by a wide margin.
1205:
The stable release naming scheme was 0.1 up to 0.13 for the first thirteen stable releases. In
February 2010 the Mercury project decided to name each stable release by using the year and month of the release. For example 10.04 is for a release made in April 2010.
613:
Other languages can then be interfaced to by calling them from these languages. However, this means that foreign language code may need to be written several times for the different backends, otherwise portability between backends will be lost.
554:
Mercury also features a foreign language interface, allowing code in other languages (depending on the chosen back-end) to be linked with
Mercury code. The following foreign languages are possible:
402:(SLD) algorithm. It can be viewed as a pure subset of Prolog with strong types and modes. As such, it is often compared to its predecessor in features and run-time efficiency.
1483:
31:
1493:
413:
phase, rather than being directly interpreted. This allows a much wider range of errors to be detected before running a program. It features a strict
341:, Computer Science department, by Fergus Henderson, Thomas Conway, and Zoltan Somogyi, under Somogyi's supervision, and released on April 8, 1995.
1478:
456:
1261:
1488:
478:
formatter. The
Software company ODASE has also been using Mercury to develop its Ontology-Centric software development platform, ODASE.
297:
262:
1082:
for a pair of variables which are assigned concrete names at compilation; for example, the above is desugared to something like:
161:
605:
514:
201:
591:
548:
1275:
1269:
601:
539:
334:
581:
509:
318:
116:
65:
257:
245:
1290:
571:
496:
197:
533:
500:
448:
425:
345:
338:
213:
189:
87:
1317:
1379:
441:
153:
61:
44:
486:
Mercury has several back-ends, which enable compiling
Mercury code into several languages, including:
452:
406:
52:
1414:
1384:
625:
124:
1235:
464:
270:
176:
82:
1368:"The execution algorithm of Mercury: an efficient purely declarative logic programming language"
1223:
526:
383:
348:
241:
57:
1389:
765:
252:
208:
1444:
1367:
1079:
72:
543:
399:
229:
1393:
1472:
1296:
1354:
1343:
1299:, language, a strongly typed object-oriented extension of Prolog, with a new syntax
460:
444:
366:
The official implementation, the
Melbourne Mercury Compiler, is available for most
1287:, language, an object-oriented extension of Prolog which compiles down to Prolog
1279:
414:
360:
157:
148:
1251:
475:
409:
principles. Unlike the original implementations of Prolog, it has a separate
1366:
Somogyi, Zoltan; Henderson, Fergus; Conway, Thomas (October–December 1996).
371:
27:
337:
language made for real-world uses. The first version was developed at the
1241:
474:
Notable programs written in
Mercury include the Mercury compiler and the
410:
20:
1284:
356:
322:
237:
233:
617:
The most commonly used back-end is the original low-level C back-end.
429:
395:
352:
314:
185:
1416:
Compile-time garbage collection for the declarative language
Mercury
1229:
1209:
There is often also a periodic snapshot of the development system
379:
375:
225:
221:
193:
181:
1070:% Could instead use io.format("fib(10) = %d\n", , !IO).
398:. It has the same syntax and the same basic concepts such as the
367:
217:
1461:
284:
532:
Aditi, a deductive database system also developed at the
1432:
463:) are expressed using pure constructs in Mercury using
536:. Mercury-0.12.2 is the last version to support Aditi.
394:Mercury is based on the logic programming language
308:
295:
279:
269:
251:
207:
175:
167:
147:
115:
93:
81:
71:
51:
32:Mercury (RemObjects BASIC programming language)
8:
1339:
1337:
1335:
363:, and a strong mode and determinism system.
359:. It features a strong, static, polymorphic
37:
400:selective linear definite clause resolution
123:
36:
1422:(Thesis). Katholieke Universiteit Leuven.
1383:
556:
1309:
1484:Functional logic programming languages
1494:Programming languages created in 1995
417:and mode system and a module system.
16:Functional logic programming language
7:
1262:Free and open-source software portal
503:(GCC), the original Mercury back-end
1272:, another functional logic language
14:
471:value through all relevant code.
1355:The Mercury Project - Benchmarks
1344:The Mercury Project - Motivation
1254:
1078:is a "state variable", which is
351:language. It is related to both
43:
1445:Ralph Becket's Mercury tutorial
1378:(1–3). Mercurylang.org: 17–64.
1222:Developers provide support for
405:The language is designed using
1240:A plugin is available for the
1234:A plugin is available for the
1:
1394:10.1016/S0743-1066(96)00068-4
447:(I/O). This enables advanced
1479:Cross-platform free software
1372:Journal of Logic Programming
602:Common Intermediate Language
540:Common Intermediate Language
335:functional logic programming
768:(in the most obvious way):
747:"Hello, World!\n"
1510:
1489:.NET programming languages
1293:, a multiparadigm language
436:Prolog statements such as
304:Melbourne Mercury Compiler
25:
19:For Mercury Autocode, see
18:
1413:Mazur, Nancy (May 2004).
455:, including compile-time
313:
303:
143:
111:
42:
1278:, a dialect language of
1084:
770:
630:
26:Not to be confused with
534:University of Melbourne
501:GNU Compiler Collection
467:, by threading a dummy
449:static program analysis
339:University of Melbourne
168:Implementation language
130:; 12 months ago
88:University of Melbourne
1217:IDE and editor support
1120:"fib(10) = "
1004:"fib(10) = "
99:; 29 years ago
1228:Flycheck library for
764:Calculating the 10th
374:platforms, including
563:Foreign language(s)
529:via the GCC back-end
453:program optimization
424:Mercury is a purely
407:software engineering
344:Mercury is a purely
271:Filename extensions
94:First appeared
39:
1320:. 8 September 2023
1211:release of the day
457:garbage collection
128:/ 8 September 2023
97:April 8, 1995
1318:"Release 22.01.8"
611:
610:
527:Assembly language
432:, since it lacks
428:language, unlike
349:logic programming
328:
327:
149:Typing discipline
1501:
1465:
1464:
1462:Official website
1447:
1441:
1435:
1430:
1424:
1423:
1421:
1410:
1404:
1403:
1401:
1400:
1387:
1363:
1357:
1352:
1346:
1341:
1330:
1329:
1327:
1325:
1314:
1264:
1259:
1258:
1257:
1201:Release schedule
1196:
1193:
1190:
1187:
1184:
1181:
1178:
1175:
1172:
1169:
1166:
1163:
1160:
1157:
1154:
1151:
1148:
1145:
1142:
1139:
1136:
1133:
1130:
1127:
1124:
1121:
1118:
1115:
1112:
1109:
1106:
1103:
1100:
1097:
1094:
1091:
1088:
1077:
1071:
1068:
1065:
1062:
1059:
1056:
1053:
1050:
1047:
1044:
1041:
1038:
1035:
1032:
1029:
1026:
1023:
1020:
1017:
1014:
1011:
1008:
1005:
1002:
999:
996:
993:
990:
987:
984:
981:
978:
975:
972:
969:
966:
963:
960:
957:
954:
951:
948:
945:
942:
939:
936:
933:
930:
927:
924:
921:
918:
915:
912:
909:
906:
903:
900:
897:
894:
891:
888:
885:
882:
879:
876:
873:
870:
867:
864:
861:
858:
855:
852:
849:
846:
843:
840:
837:
834:
831:
828:
825:
822:
819:
816:
813:
810:
807:
804:
801:
798:
795:
792:
789:
786:
783:
780:
777:
774:
766:Fibonacci number
760:
757:
754:
751:
748:
745:
742:
739:
736:
733:
730:
727:
724:
721:
718:
715:
712:
709:
706:
703:
700:
697:
694:
691:
688:
685:
682:
679:
676:
673:
670:
667:
664:
661:
658:
655:
652:
649:
646:
643:
640:
637:
634:
568:C (both levels)
557:
490:Production level
439:
291:
288:
286:
265:standard library
138:
136:
135:8 September 2023
131:
127:
107:
105:
100:
73:Designed by
47:
40:
1509:
1508:
1504:
1503:
1502:
1500:
1499:
1498:
1469:
1468:
1460:
1459:
1456:
1451:
1450:
1442:
1438:
1431:
1427:
1419:
1412:
1411:
1407:
1398:
1396:
1365:
1364:
1360:
1353:
1349:
1342:
1333:
1323:
1321:
1316:
1315:
1311:
1306:
1260:
1255:
1253:
1250:
1219:
1203:
1198:
1197:
1194:
1191:
1188:
1185:
1182:
1179:
1176:
1173:
1170:
1167:
1164:
1161:
1158:
1155:
1152:
1149:
1146:
1143:
1140:
1137:
1134:
1131:
1128:
1125:
1122:
1119:
1116:
1113:
1110:
1107:
1104:
1101:
1098:
1095:
1092:
1089:
1086:
1080:syntactic sugar
1075:
1073:
1072:
1069:
1066:
1063:
1060:
1057:
1054:
1051:
1048:
1045:
1042:
1039:
1036:
1033:
1030:
1027:
1024:
1021:
1018:
1015:
1012:
1009:
1006:
1003:
1000:
997:
994:
991:
988:
985:
982:
979:
976:
973:
970:
967:
964:
961:
958:
955:
952:
949:
946:
943:
940:
937:
934:
931:
928:
925:
922:
919:
916:
913:
910:
907:
904:
901:
898:
895:
892:
889:
886:
883:
880:
877:
874:
871:
868:
865:
862:
859:
856:
853:
850:
847:
844:
841:
838:
835:
832:
829:
826:
823:
820:
817:
814:
811:
808:
805:
802:
799:
796:
793:
790:
787:
784:
781:
778:
775:
772:
762:
761:
758:
755:
752:
749:
746:
743:
740:
737:
734:
731:
728:
725:
722:
719:
716:
713:
710:
707:
704:
701:
698:
695:
692:
689:
686:
683:
680:
677:
674:
671:
668:
665:
662:
659:
656:
653:
650:
647:
644:
641:
638:
635:
632:
623:
523:
492:
484:
437:
392:
298:implementations
283:
261:
139:
134:
132:
129:
103:
101:
98:
66:object-oriented
35:
24:
17:
12:
11:
5:
1507:
1505:
1497:
1496:
1491:
1486:
1481:
1471:
1470:
1467:
1466:
1455:
1454:External links
1452:
1449:
1448:
1436:
1425:
1405:
1385:10.1.1.46.9861
1358:
1347:
1331:
1308:
1307:
1305:
1302:
1301:
1300:
1294:
1288:
1282:
1273:
1266:
1265:
1249:
1246:
1245:
1244:
1238:
1232:
1226:
1218:
1215:
1202:
1199:
1085:
854:implementation
771:
714:implementation
631:
622:
619:
609:
608:
599:
595:
594:
589:
585:
584:
579:
575:
574:
569:
565:
564:
561:
552:
551:
546:
544:.NET Framework
542:(CIL) for the
537:
530:
522:
519:
518:
517:
512:
507:
504:
491:
488:
483:
480:
391:
388:
326:
325:
311:
310:
306:
305:
301:
300:
293:
292:
281:
277:
276:
273:
267:
266:
255:
249:
248:
214:Cross-platform
211:
205:
204:
179:
173:
172:
169:
165:
164:
151:
145:
144:
141:
140:
121:
119:
117:Stable release
113:
112:
109:
108:
95:
91:
90:
85:
79:
78:
77:Zoltan Somogyi
75:
69:
68:
55:
49:
48:
15:
13:
10:
9:
6:
4:
3:
2:
1506:
1495:
1492:
1490:
1487:
1485:
1482:
1480:
1477:
1476:
1474:
1463:
1458:
1457:
1453:
1446:
1443:Adapted from
1440:
1437:
1434:
1429:
1426:
1418:
1417:
1409:
1406:
1395:
1391:
1386:
1381:
1377:
1373:
1369:
1362:
1359:
1356:
1351:
1348:
1345:
1340:
1338:
1336:
1332:
1319:
1313:
1310:
1303:
1298:
1297:Visual Prolog
1295:
1292:
1289:
1286:
1283:
1281:
1277:
1274:
1271:
1268:
1267:
1263:
1252:
1247:
1243:
1239:
1237:
1233:
1231:
1227:
1225:
1221:
1220:
1216:
1214:
1212:
1207:
1200:
1083:
1081:
863:import_module
797:import_module
769:
767:
657:import_module
629:
627:
620:
618:
615:
607:
603:
600:
597:
596:
593:
590:
587:
586:
583:
580:
577:
576:
573:
570:
567:
566:
562:
559:
558:
555:
550:
547:
545:
541:
538:
535:
531:
528:
525:
524:
520:
516:
513:
511:
508:
505:
502:
498:
494:
493:
489:
487:
481:
479:
477:
472:
470:
466:
462:
458:
454:
450:
446:
443:
435:
434:extra-logical
431:
427:
422:
418:
416:
412:
408:
403:
401:
397:
389:
387:
385:
381:
377:
373:
369:
364:
362:
358:
354:
350:
347:
342:
340:
336:
332:
324:
320:
316:
312:
309:Influenced by
307:
302:
299:
294:
290:
282:
278:
274:
272:
268:
264:
259:
256:
254:
250:
247:
243:
239:
235:
231:
227:
223:
219:
215:
212:
210:
206:
203:
199:
195:
191:
187:
183:
180:
178:
174:
170:
166:
163:
159:
155:
152:
150:
146:
142:
126:
122:22.01.8
120:
118:
114:
110:
96:
92:
89:
86:
84:
80:
76:
74:
70:
67:
63:
59:
56:
54:
50:
46:
41:
33:
29:
22:
1439:
1428:
1415:
1408:
1397:. Retrieved
1375:
1371:
1361:
1350:
1324:18 September
1322:. Retrieved
1312:
1242:NetBeans IDE
1210:
1208:
1204:
1114:write_string
1074:
998:write_string
763:
741:write_string
624:
616:
612:
553:
506:High-level C
485:
473:
468:
465:linear types
461:input/output
445:input/output
433:
423:
419:
404:
393:
365:
343:
330:
329:
287:.mercurylang
1280:Standard ML
1236:Eclipse IDE
626:Hello World
426:declarative
415:static type
411:compilation
361:type system
346:declarative
162:polymorphic
1473:Categories
1399:2008-08-30
1304:References
495:Low-level
476:Prince XML
442:imperative
440:(cut) and
382:, and for
104:1995-04-08
62:functional
1380:CiteSeerX
1291:Oz/Mozart
1144:write_int
1025:write_int
788:interface
648:interface
604:(CIL) or
482:Back-ends
372:Unix-like
260:compiler,
83:Developer
28:Mercurial
1248:See also
621:Examples
560:Back-end
390:Overview
177:Platform
53:Paradigm
21:Autocode
1285:Logtalk
1213:(ROTD)
588:Erlang
384:Windows
357:Haskell
331:Mercury
323:Haskell
280:Website
253:License
246:Android
242:Windows
238:OpenBSD
234:FreeBSD
230:Solaris
171:Mercury
133: (
102: (
38:Mercury
1382:
776:module
636:module
592:Erlang
549:Erlang
430:Prolog
396:Prolog
353:Prolog
315:Prolog
296:Major
186:x86-64
158:static
154:Strong
1433:ODASE
1420:(PDF)
1276:Alice
1270:Curry
1230:Emacs
923:=<
639:hello
578:Java
469:world
380:macOS
376:Linux
333:is a
226:macOS
222:Linux
194:SPARC
182:IA-32
58:Logic
1326:2023
1087:main
977:main
935:else
929:then
875:func
812:main
809:pred
720:main
672:main
669:pred
582:Java
521:Past
510:Java
499:for
451:and
370:and
368:Unix
355:and
319:Hope
289:.org
263:LGPL
218:Unix
198:Java
196:64,
1390:doi
1224:Vim
1186:IO2
1168:IO2
1162:IO1
1150:fib
1132:IO1
1126:IO0
1093:IO0
1076:!IO
1031:fib
974:)).
959:fib
938:fib
899:fib
893:int
884:int
878:fib
866:int
845:det
836::uo
824::di
779:fib
705:det
696::uo
684::di
598:IL
285:www
258:GPL
202:CLI
190:Arm
30:or
1475::
1388:.
1376:29
1374:.
1370:.
1334:^
1195:).
1192:IO
1180:nl
1174:io
1171:),
1159:),
1156:10
1138:io
1135:),
1108:io
1105::-
1099:IO
1067:).
1064:IO
1061:(!
1058:nl
1052:io
1049:),
1046:IO
1040:),
1037:10
1019:io
1016:),
1013:IO
992:io
989::-
983:IO
980:(!
917:if
872::-
860::-
851::-
842:is
830:io
818:io
806::-
800:io
794::-
785::-
773::-
759:).
756:IO
735:io
732::-
726:IO
723:(!
711::-
702:is
690:io
678:io
666::-
660:io
654::-
645::-
633::-
628::
606:C#
515:C#
386:.
378:,
321:,
317:,
275:.m
244:,
240:,
236:,
232:,
228:,
224:,
220:,
216::
209:OS
200:,
192:,
188:,
184:,
160:,
156:,
64:,
60:,
1402:.
1392::
1328:.
1189:,
1183:(
1177:.
1165:,
1153:(
1147:(
1141:.
1129:,
1123:,
1117:(
1111:.
1102:)
1096:,
1090:(
1055:.
1043:!
1034:(
1028:(
1022:.
1010:!
1007:,
1001:(
995:.
986:)
971:2
968:-
965:N
962:(
956:+
953:)
950:1
947:-
944:N
941:(
932:1
926:2
920:N
914:(
911:=
908:)
905:N
902:(
896:.
890:=
887:)
881:(
869:.
857:.
848:.
839:)
833::
827:,
821::
815:(
803:.
791:.
782:.
753:!
750:,
744:(
738:.
729:)
717:.
708:.
699:)
693::
687:,
681::
675:(
663:.
651:.
642:.
572:C
497:C
438:!
137:)
106:)
34:.
23:.
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.