Swi Prolog For Mac
The following Comparison of Prolog implementations provides a reference for the relative feature sets and performance of different implementations of the Prolog computer programming language.
Portability[edit]
There are Prolog implementations that are radically different, with different syntax and different semantics (e.g. Visual Prolog)[1] and sub-communities have developed around different implementations.[1]
Code that strictly conforms to the ISO-Prolog core language is portable across ISO-compliant implementations. However, the ISO standard for modules was never accepted by most Prolog implementors.[1]
How to Run Prolog The examples in this Prolog Tutorial were developed using either Quintus Prolog running on Digital Equipment Corporation MicroVAXes (ancient history) or using SWI Prolog on either Sun Sparks (long ago), in Windows on a PC (a while ago), or (recently) under the OS X operating system on a Mac. Hi, A real Prolog MacOS app is getting close to testing phase. One of the remaining issues is integration with the finder. Below are some thoughts about that. Comments from Mac users is welcome. Currently, I register Prolog for.pl and.prolog files (still need to figure out how to get an icon there). Double clicking always sends a message to the already running app, while I think.
Factors that can adversely affect portability include: use of bounded vs. unbounded integer arithmetic, additional types such as string objects, advanced numeric types (rationals, complex), feature extensions such as Unicode, threads, and tabling.[2] Use of libraries unavailable in other implementations and library organisation:[1]
Currently, the way predicates are spread over the libraries and system built-ins differs enormously. [...] Fortunately, there are only few cases where we find predicates with the same name but different semantics (e.g. delete/3
)
Main features[edit]
Platform | Features | Toolkit | Prolog Mechanics | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Name | OS | Licence | Native Graphics | Compiled Code | Unicode | Object Oriented | Native OS Control | Stand Alone Executable | C Interface[3] | Java Interface[3] | Interactive Interpreter | Debugger | Code Profiler | Syntax |
BProlog | Unix, Windows, Mac OS X | Free for non-commercial uses | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | ISO-Prolog, plus event-handling, CLP(FD), and tabling | |
JIProlog | JVM, Android | Shareware/Commercial and AGPL | Yes | Yes | Yes via Java | Yes | Yes via Java | Yes | Yes | Yes | ISO-Prolog | |||
Ciao | Unix, Windows, Mac OS X | GPL, LGPL | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | ISO-Prolog, plus extensions | ||
DOS-PROLOG | MS-DOS | Shareware | Yes | Yes | Yes | Yes | Yes | Yes | Edinburgh Prolog | |||||
ECLiPSe | Linux, Windows, Solaris, macOS | MPL | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Extended Prolog, Multi-dialect, including ISO | ||||
GNU Prolog | Unix, Windows, Mac OS X | GPL, LGPL | Yes | Yes | Yes | Yes | Yes | Yes | ISO-Prolog | |||||
Jekejeke Prolog | JVM, Android | Distribution Evaluation | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | ISO-Prolog, Java API | |||
JLog | JVM | GPL | Yes | Yes | Yes | Yes | ISO-Prolog | |||||||
JScriptLog | Web Browser | GPL | Yes | ISO-Prolog | ||||||||||
jTrolog | JVM | LGPL | Yes | Yes | Yes | Yes | ISO-Prolog tests[permanent dead link] | |||||||
LPA-PROLOG | Windows | Commercial | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Edinburgh Prolog with extensions |
Open Prolog | Mac OS | Freeware | Yes | |||||||||||
Poplog Prolog | Linux (32- and 64-bit), Unix, Windows | Free Open Source | Only through POP-11, on Linux | Yes | Yes | Yes | Yes | Yes | Yes | Edinburgh Prolog, with interfaces to Poplog Common Lisp and Pop-11 | ||||
SICStus Prolog | Unix, Linux, Windows, macOS | Commercial | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | ISO-Prolog |
Strawberry Prolog | Windows, Unix | Freeware, Commercial | Yes | Yes | Yes | Yes | Yes | Not ISO-Prolog + extensions | ||||||
SWI-Prolog | Unix, Linux, Windows, macOS | BSD License | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | ISO-Prolog, Edinburgh Prolog | |
tuProlog | JVM, Android | LGPL | Yes | Yes | Yes | Yes | Yes | Yes | ISO-Prolog | |||||
Visual Prolog | Windows | Freeware, Commercial | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |||
XSB Prolog | Linux, Windows, Solaris, macOS | LGPL | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | ISO-Prolog, tabled WFS | ||
YAP-Prolog | Linux, Windows, Solaris, Mac OS X, HP-UX | GPL or Artistic (user choice) | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Edinburgh, ISO-Prolog, Quintus and SICStus Prolog compatible |
Operating system and Web-related features[edit]
Web-related | ||||||||
---|---|---|---|---|---|---|---|---|
Name | Conditional compilation | Sockets | Multi-threading | Tabling | HTTP client | HTTP server | HTML Parser | RDF Triple store |
BProlog | Yes | |||||||
Ciao | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
ECLiPSe | Yes | Yes | Yes | Yes | Yes | |||
GNU Prolog | Yes | |||||||
Jekejeke Prolog | Yes | Yes | Yes | Yes | Yes | |||
LPA-Prolog | Yes | Yes | Yes | Yes | ||||
SICStus Prolog | Yes | Yes | Yes | |||||
SWI-Prolog | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
Visual Prolog | Yes | Yes | Yes | Yes | Yes | Yes | ||
XSB | Yes | Yes | Yes | Yes | Yes | |||
YAP-Prolog | Yes | Yes | Yes | Yes |
Static analysis[edit]
Name | Type checker | Determinacy checker | Call-pattern checker |
---|---|---|---|
Ciao | Yes | Yes | Yes |
GNU Prolog | |||
Jekejeke Prolog | |||
SICStus Prolog | Yes | ||
SWI-Prolog | Yes | ||
Visual Prolog | Yes | Yes | Yes |
XSB | |||
YAP-Prolog |
Optimizations[edit]
Name | Tail-Call Optimization | Choice Point Elimination | Environment Trimming | Just-in-Time Indexing |
---|---|---|---|---|
Ciao | Yes | Yes | Yes | ? |
ECLiPSe | Yes | Yes | Yes | multi-argument (compile time) |
GNU Prolog | Yes | Yes | Yes | ? |
Jekejeke Prolog | Yes (runtime) | Yes (runtime) | Yes (runtime) | Yes |
SICStus Prolog | Yes | Yes | Yes | |
SWI-Prolog | Yes | Yes | Yes | Yes |
Visual Prolog | Yes (compile time) | Yes (compile time) | N/A | N/A (compile time) |
XSB | Yes | Yes | Yes | ? |
YAP-Prolog | Yes | Yes | Yes | Yes |
Release[edit]
Name | Version | Date |
---|---|---|
BProlog | 8.1 | 2014-02-23 |
JIProlog | 4.1.6.1 | 2018-03-17 |
Ciao | 1.19.0 | 2020-03-21 |
DOS-PROLOG | 6.0 | |
ECLiPSe | 7.0_54 | 2020-02-26 |
GNU Prolog | 1.4.5 | 2018-07-14 |
Jekejeke Prolog | 1.3.1 | 2018-11-02 |
JLog | 1.3.6 | 2007-09-13 |
JScriptLog | 0.7.5 beta | 2007-09-10 |
jTrolog | ||
LPA-PROLOG | 7.0 | 2019-12-19 |
Open Prolog | ||
Poplog Prolog | V15.65 | 2015-10-14 |
SICStus Prolog | 4.6.0 | 2020-05-04 |
Strawberry Prolog | 3.0 Beta 4 | 2013-12-10 |
SWI-Prolog | 8.2.0 | 2020-05-27 |
tuProlog | 3.2.1 | 2017-02-14 |
Visual Prolog | 9.0, Build 902 | 2019-04-26 |
XSB Prolog | 3.8 | 2017-10-29 |
YAProlog | 6.3.3 | 2013-01-21 |
Benchmarks[edit]
- Benchmarking issues: Odd Prolog benchmarking, Performance differences.[4]
- Benchmarking software: older, Dobry[permanent dead link], Aquarius benchmark suite, (Bothe, 1990),[5](Demoen et al. 2001), benchmark descriptions
- Benchmarking results: B-Prolog, SICStus, XSB,[6] SICStus vs Yap vs hProlog[7]
- Benchmarking results: Survey of java prolog engines by Michael Zeising
- Benchmarking results: OpenRuleBench yearly open-source benchmark of rule engines
References[edit]
- ^ abcdWielemaker, J.; Costa, V. T. S. (2011). 'On the Portability of Prolog Applications'. Practical Aspects of Declarative Languages. Lecture Notes in Computer Science. 6539. p. 69. CiteSeerX10.1.1.1030.9396. doi:10.1007/978-3-642-18378-2_8. ISBN978-3-642-18377-5.
- ^Jan Wielemaker and Vıtor Santos Costa: Portability of Prolog programs: theory and case-studies. CICLOPS-WLPE Workshop 2010.
- ^ abC/Java interface can also be used for graphics and OS control.
- ^B. Demoen, and P. Nguyen, About unnecessary performance differences between Prolog implementations, Proceedings of the Colloquium on Implementation of Constraint and Logic Programming Systems (CICLOPS 2001)
- ^Bothe, K. (1990). 'A prolog space benchmark suite'. ACM SIGPLAN Notices. 25 (12): 54–60. doi:10.1145/122193.122197.
- ^A Summary of XSB Performance (1993)
- ^Demoen, B.; Nguyen, P. L.; Vandeginste, R. (2002). 'Copying Garbage Collection for the WAM: to Mark or Not to Mark?'. Logic Programming. Lecture Notes in Computer Science. 2401. pp. 194–208. CiteSeerX10.1.1.13.2586. doi:10.1007/3-540-45619-8_14. ISBN978-3-540-43930-1.
External links[edit]
- Overview of Prolog Systems by Ulrich Neumerkel
CSE 341 - Programming Languages
We're using SWI Prolog, version 6.2.6.
When you start Prolog, you should see an introductory greeting and then the Prolog command prompt:
Running Prolog on attu
If you're planning on loading a file, it will simplify things to first navigate to the directory that contains your file, so that Prolog can find it easily.
In any case run Prolog from the command line using
Running Prolog on the CSE Undergrad Windows Machines
Run Prolog from the “Start” menu. It's here:
All Programs / DEV TOOLS & LANGUAGES / SWI-Prolog
If you want to load a file, you'll either need to specify an absolute file path, or change the current working directory to the appropriate place. Here's how to change the current working directory. If your files are in your home directory on the Z drive in the cse341 subdirectory, type this at the Prolog command prompt:
(The double backslash is needed because a single backslash indicates some special character, e.g. n for newline. And in case you're wondering, X will be unified with the previous working directory.)
Double-clicking on a .pl Prolog source file is going to start perl, so that's not going to work.
Running Prolog on a Personal Machine
SWI Prolog is available for Windows, Mac, and Linux. Here's the download page: http://www.swi-prolog.org/Download.html.
A few additional Macintosh hints: if you use the Finder and double-click on SWI Prolog in Applications, depending on your security settings, you may get an error. If you do, try right-clicking (or control-clicking) on the application instead, and say “run it anyway”. You can also run it from the command line using the swipl executable in /Applications/SWI-Prolog.app/Contents/MacOS, assuming you installed it in the default location. To use the graphical debugger, install xquartz (X11), then open a X11 terminal, and run Prolog from there.
Basic Prolog Commands
Swi-prolog For Mac
A few essential commands:
Swi Prolog Machine Learning
- halt.
- exit Prolog (short form: control-d)
- consult(filename).
- load the file named filename.pl (note the added .pl extension). If you need some more complex name (for example with a path), put it in single quotes, for example consult('/Users/schmertzkopf/squid.pl').
- [filename].
- shorthand for consult
- help(topic) or apropos(topic).
- Brings up the relevant section of the manual in a separate window (so requires X for linux/Mac).
Editing Prolog Code
Prepare source files using any convenient editor. The standard file extension for Prolog files is .pl
If you want to use emacs, include this in your .emacs file in your home directory: (Without this, emacs is going to think you're writing in perl.)
There are other versions of emacs Prolog mode if you want to try one - see e.g. Using SWI-Prolog with GNU-Emacs. However, the default mode should be fine for 341.
Debugging
Get Swi-prolog For Mac
SWI Prolog provides two interfaces to the debugger: a text-based and a graphical interface:
The graphical debugger doesn't seem to be installed with the version of Prolog on the Lab linux machines, unfortunately. It is on the Lab Windows machines, though.Swi Prolog Editor Mac
For old-school debugging use the write goal. For example, here it is in the body of a rule: