Prolog · online compiler

Run Prolog online

Run Prolog online — SWI-Prolog 9, logic programming, browser-hosted.

Version
Firecracker microVM live per-test verdicts multi-file compile

Prolog is the definitive logic-programming language: state a set of facts and rules, ask a query, watch the solver unify and backtrack. Still used in NLP research, constraint solving, and academic AI.

ls-judge runs SWI-Prolog 9 inside a Firecracker microVM.

Starter code

What you get in Prolog

Clicking "Run now" opens the playground with this exact code and a matching test case pre-loaded — passes on first Run.

prolog
Prolog 9
main :- read_term(N, []), N2 is N * 2, write(N2), nl.
stdin →21.
expected →42
FAQ

Common questions about Prolog on ls-judge

Which Prolog?
SWI-Prolog 9 — the modern, batteries-included implementation.
CLP(FD) / CLP(R)?
Yes — SWI ships them.
Free?
Yes.
Entry filename?
main.pl.
Further reading
Also try