SWI-Prolog screenshot
SWI-Prolog

SWI-Prolog is a versatile and highly scalable implementation of the Prolog language, originally gaining popularity in educational environments but now widely used for application development. Its development is driven by the need to integrate with other IT components, and it offers a rich interface to various document types and network protocols, as well as a comprehensive low-level interface to C, which serves as the foundation for high-level interfaces to languages like C++, Java, C#, and Python.

SWI-Prolog extends the Prolog language with advanced data types such as dicts and strings, alongside full support for Unicode and unbounded integers, ensuring smooth data exchange with other components. The system is designed to scale efficiently, with robust multi-threading support that takes full advantage of multi-core hardware, making it suitable for embedding in concurrent applications. Its Just-In-Time Indexing (JITI) feature provides efficient support for predicates with millions of clauses, ensuring that even large-scale applications run smoothly.

SWI-Prolog also unifies many of the extensions developed by the Prolog community, such as tabling, constraints, global variables, destructive assignment, delimited continuations, and interactors, making it a comprehensive and powerful tool for developers.

Detailed Features of SWI-Prolog:

  • Fast Compilation and Efficiency:
    • Fast Compilation: SWI-Prolog is optimized for quick compilation, ensuring minimal delays during development.
    • Memory Management: The system is robust and free of memory leaks, ensuring stable performance even in long-running applications.
    • Scalability: SWI-Prolog scales effectively for large applications, handling large datasets and complex logic with ease.
  • Advanced Arithmetic and Data Handling:
    • Just-In-Time Indexing (JITI): Offers efficient indexing for both static and dynamic code on any argument, simplifying the management of multi-moded relations with numerous clauses.
    • Unbounded Integer and Rational Number Arithmetic: Powered by the GMP library, supporting complex calculations without limitations on number size.
    • UNICODE Support: Full internal handling of the UNICODE character set, ensuring compatibility with international character sets.
  • Prolog Language Extensions:
    • Modules: Upward compatible with Quintus and SICStus, facilitating modular development.
    • Garbage Collection: Transparent to C/C++ code, including atom and clause garbage collection, ensuring efficient memory usage.
    • Last-Call Optimization: Enhances performance by optimizing recursive calls.
    • Dynamic Runtime Expansion: Automatically expands runtime stacks as needed, preventing stack overflow errors.
    • Exception Handling: Includes comprehensive support for catching and throwing exceptions, compatible with C/C++ interfaces.
  • Enhanced Programming Constructs:
    • Attributed Variables and Coroutining: Support for freeze/2, when/2, and dif/2, allowing for advanced control flow and logic programming techniques.
    • Global Variables and Cyclic Terms: Provide additional flexibility in handling complex data structures and algorithms.
    • Occurs-Check Handling: Flag-controlled handling of the occurs-check, with options for false, true, or error, ensuring consistency in logic evaluation.
  • Multi-Threading and Concurrency:
    • Multi-Threading Support: Designed to efficiently handle multi-threaded applications, making full use of multi-core processors.
    • Engines (Interactors): Provide coroutines for state accumulation and massive concurrency, ideal for applications like swarm intelligence and simulations.
    • Delimited Continuations: A powerful tool for creating new control structures and aspect-oriented programming.
  • Advanced Query Resolution:
    • Tabling (SLG Resolution): A robust resolution technique that ensures guaranteed termination of complex interrelated rules, improving the reliability of query results.
    • Well-Founded Semantics for Negation: Provides a solid foundation for handling negation in logic programming.
    • Incremental Tabling: Automatically updates affected tables when the knowledge base changes, ensuring that results remain accurate and up-to-date.
  • Development Tools and Environment:
    • Native Editor: SWI-Prolog includes an editor written in Prolog that closely resembles Emacs, offering features like semantic highlighting based on real-time code analysis.
    • Pack System: An add-on distribution and installation mechanism, allowing for easy management of extensions and third-party libraries.
  • Server Applications:
    • Web Server Framework: Includes an extensive HTTP framework for building server applications, supporting both REST services and end-user applications with HTML5, CSS, and JavaScript.
  • Prolog as a Unifying Language
    • Integration with Other Components: SWI-Prolog serves as a versatile platform, acting as a glue language that unifies various components in complex systems, making it an ideal choice for applications that require integration across different technologies.

SWI-Prolog stands out as a powerful and versatile tool for both educational purposes and professional application development. Its rich feature set, robust scalability, and extensive support for modern programming constructs make it a go-to choice for developers looking to leverage the full potential of the Prolog language.

SWI-Prolog - Changelog:

  • DOC: Explain issues and features of the C-API Boolean functions.
  • FIXED: Race conditions in thread_signal/2 and friends.
  • TEST: Avoid interference between thread_wait tests. Tests send concurrent signals using a detached thread that could still be running, affecting subsequent tests.
  • TEST: Test for getting an I/O error on a broken pipe may succeed. Turns out the pipe size on Asahi/Fedoare 40 is 256K. Now writing a max of 1.2Mb rather than 100K.
  • ADDED: Prolog flag dir_sep Complements path_sep and path_max to get properties on the file naming conventions and limits.
  • FIXED: #1311 Possible stack corruption in PL_unify_text() Cause of this crash is a failure to verify return from PL_new_term_ref(). There were more issues with the code
  • though. Lack of local space could corrupt a string living on the stack. We can discard the term reference.
Download SWI-Prolog:
For windows 32 bit:
Size: 13.20 MB - Download
For windows 64 bit:
Size: 13.19 MB - Download