Tutorsbot

Online Prolog Compiler

Prolog is a logic programming language used in AI and computational linguistics. Run Prolog code instantly in your browser.

main
% Online Prolog compiler
% Write Prolog code in this online editor and run it

greet(Name) :- format('Hello, ~w!~n', [Name]).

:- greet('Tutorsbot').

Prolog is a logic programming language used in AI and computational linguistics. Run Prolog code instantly in your browser.

What is Prolog?

Prolog (PROgrammation en LOGique) is a declarative logic-programming language created in 1972 at the University of Marseille. You describe facts and rules; the engine searches for proofs by unification and backtracking. Prolog is foundational to computational linguistics (Definite Clause Grammars were invented to describe natural languages), expert systems, and classical AI research.

Why run Prolog in the browser

SWI-Prolog's installer is hefty and the interactive REPL takes a moment to learn. A browser sandbox is a friction-free way to experiment with backtracking, unify two terms, or trace a search. SWI-compatible Prolog runs in the sandbox; you can write clauses and query them within seconds.

Common Prolog tasks

Expert systems and rule engines, natural-language parsing via DCGs (Definite Clause Grammars), constraint solvers, theorem provers, puzzle solvers (the classic Einstein/Zebra puzzle is a favourite teaching example), and database queries issued as Prolog goals (?-). The sandbox runs SWI-compatible Prolog 8.2.4.

Getting started with Prolog 8.2.4

Paste a fact or a rule, then a goal — for example likes(mary, food). likes(john, wine). likes(john, mary). ?- likes(mary, X). — and hit Run. The query's answers appear in stdout. The highlighter understands Prolog atoms, variables (capitalised identifiers), predicate syntax, and the :- operator that separates rule head from body.

Why use the Prolog online compiler?

  • Prolog 8.2.4
  • Logic programming
  • AI applications
  • Pattern matching

Frequently Asked Questions

Is the Prolog online compiler free?
Yes — Tutorsbot's Prolog compiler is completely free. No account required, no installation, and no usage limits.
Do I need to install Prolog?
No. The Prolog compiler runs entirely in your browser. No runtime, no SDK, no PATH configuration. Open the page and start coding.
Is my Prolog code saved between sessions?
Yes — your code autosaves to your browser's local storage so you can resume where you left off. You can also generate a shareable URL.
Can I share Prolog code with others?
Yes. Click the Share button to copy a URL that encodes your script. Anyone with the link can open and run it instantly — no account required on their end.
Is the Prolog compiler safe to use?
Absolutely. Every program runs in an isolated sandbox. Your local system is never exposed to the executed code, and nothing is persisted after the execution window.