1. Prolog CLI

  • Start Prolog’s repl

$ swipl
  • Run code within prolog repl (prolog statements must end with '.')

$ swipl
?- write("hello, world").
  • Start a program within swi-prolog repl

$ swipl
?- [program]
  • Exit swi-prolog

$ swipl
?- halt.
  • prolog code ends with .pl

$ cat << EOF > hello.pl
write("hello, world").
EOF
  • start prolog and load code

$ swipl -s hello.pl
  • Proglog Help

$ swipl
?- help.
?- help(Topic).
  • Exit (halt) Prolog:

$ swipl
?- halt.
  • Load our Data:

$ swipl
?- [db].
?- consult('db.pl'). # alternative to [db].
?- listing.          # shows/lists the db data