Skip to content

Execution in browser

Patrick Hammer edited this page Jan 29, 2026 · 5 revisions

It needs this .js file, invoke from a HTML file:

https://wasm.swi-prolog.org/wasm/swipl-bundle.js

The Prolog code to let the swipl bundle digest:

cd /PeTTa/src
cat *.pl > PETTA
echo "metta(I) :- process_metta_string(I,O), swrite(O,S), format("Result: ~w~n",[S])." >> PETTA

Then in Javascript: Prolog.query('metta("YOUR_METTA_CODE").').once()

Bundle for v1.0.1:

pettaweb_v1.0.1.zip

Examples:

Clone this wiki locally