13 Using SWI-Prolog in your browser (WASM)
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Introduction
      • Overview
      • Initialising and Managing a Prolog Project
      • Built-in Predicates
      • SWI-Prolog extensions
      • Modules
      • Tabled execution (SLG resolution)
      • Constraint Logic Programming
      • CHR: Constraint Handling Rules
      • Multithreaded applications
      • Coroutining using Prolog engines
      • Foreign Language Interface
      • Using SWI-Prolog in your browser (WASM)
        • Loading and initializing Prolog
        • Calling Prolog from JavaScript
        • Accessing JavaScript from Prolog
      • Deploying applications
      • The SWI-Prolog library
      • Hackers corner
      • Compatibility with other Prolog dialects
      • Glossary of Terms
      • SWI-Prolog License Conditions and Tools
      • Summary
      • Bibliography
    • Packages

13 Using SWI-Prolog in your browser (WASM)

Emscripten can compile C and C++ code to WebAssembly (WASM). WASM runs on a virtual machine that is provided by almost all modern browsers. This allows for compiling the SWI-Prolog source to WASM and run it in your browser. We keep up-to-data instructions for building the WASM version on the wiki page.

Currently the WASM version is a fairly comprehensive version of SWI-Prolog. It contains the core and a good selection of the packages, including many of the foreign packages.


Section Index


13.1 Loading and initializing Prolog
13.1.1 Loading Prolog files
13.2 Calling Prolog from JavaScript
13.2.1 The JavaScript class Query
13.2.2 Translating data between JavaScript and Prolog
13.2.2.1 Translating JavaScript data to Prolog
13.2.2.2 Translating Prolog data to JavaScript
13.3 Accessing JavaScript from Prolog
13.3.1 Asynchronous access to JavaScript from Prolog
13.3.2 JavaScript Promise that can be aborted