All Prolog-queries,facts and rules are ended by writing a dot. So to get helt in Prolog type: help.
Prolog command interpreter is started by typing pl in a folder where the program source files are located.
What you get by doing this is:
Welcome to SWI-Prolog (Version 2.8.6) Copyright (c) 1993-1997 University of Amsterdam. All rights reserved. For help, use ?- help(Topic). or ?- apropos(Word). 1 ?-
Use of the command interpreter happens so that you load a program from a file for the interpreter and the give various queries to the interpreter. The loading command is:
consult(file).
Or as a short hand:
[file].So for instance:
1 ?- consult(harjoitustyo.pl).
or
1 ?- consult('/m/dawn/home/u7/t93540/foo').
1 ?- consult('c:/tmp/swi/father.pl').
1 ?- consult(['c:/tmp/swi/f_facts.pl','c:/tmp/swi/f_rules.pl']).
You exit from Prolog by giving command halt, or striking ctrl-D.
Interrupting of execution you will occationally need to do if the program goes to an infinite loop.. This is achieved by striking ctrl-C. You get then the the promp:
Action (h for help) ? Typing an 'h' gets us: a: abort b: break c: continue e: exit g: goals t: trace h (?): help Action (h for help) ?
For this promp "e" exits Prolog-interpreter, "c" continues program execution, "t" switces to debugging mode and "h" returns to help-menu.
Command help(command) gives you help . Example:
Welcome to SWI-Prolog (Version 2.8.6) Copyright (c) 1993-1997 University of Amsterdam. All rights reserved. For help, use ?- help(Topic). or ?- apropos(Word). 1 ?- help(exit).
gives the description of the command:
exit(+Label, +Value) Calling exit/2 makes the innermost block which Label unifies exit. The block's ExitValue is unified with Value. If this unification fails the block fails. Yes