Trealla Prolog

Public Library0.12.0updated a day ago510.69 KB
COPY
wapm install guregu/trealla

Need help using WAPM?

Get started here

Commands

tpl

Files

  • Readme.md

Modules

Trealla Prolog

This is a fork of Trealla Prolog for experimenting with WebAssembly/WASI. For more info on Trealla, check out the parent repository.

We endeavor to keep this fork as close as possible to the upstream and contribute all stable changes upstream. Ideally, when WASM support is better stablized, this fork won't need to exist.

Binaries on WAPM

You can grab WASM binary builds from guregu/trealla on WAPM. These builds are uploaded automatically for each release.

Differences from upstream

  • library(wasm) JSON-based programmatic toplevel.
  • library(wasm_*) host-guest interop.
  • library(pseudojson) Very fast JSON parser/generator (but not validator).
  • WASM system predicates: '$host_call'/2 and '$host_resume'/1 (see js_eval/2 in library/wasm_js.pl).

Compile targets

There's a bunch of new compile targets for WASM.

wasm

make wasm will build a pure WASI version of Trealla: tpl.wasm. This binary can be executed by any runtime that supports WASI. (Mostly) upstreamed.

libtpl

make libtpl will build a WASM binary with host calls enabled: libtpl.wasm. This adds host-guest interop exports and imports that break pure WASI compatibility. This is currently used by the Go port.

libtpl-js

make libtpl-js builds the trealla-js version of libtpl. Includes JS-specific predicates.

libtpl-spin

make libtpl-spin builds the Spin-flavored libtpl.

make SPINDIR=path/to/spin/source wit to generate the WASM component code via wit-bindgen.

Spin Components

See library/spin.pl.

  • Inbound HTTP (via http_handler/4 multifile predicate)
  • Outbound HTTP (via http_fetch/3)
  • Outbound PostgreSQL
  • Inbound Redis
  • Outbound Redis

See also

<1klast week

Latest version

0.12.0

Latest updated

a day ago

Unpackaged size

510.69 KB

License

MIT

Collaborators

    Run it in the browser