(SWI-)prolog examples and discussion
Note: these notes were originally developed for gnu prolog, and we have since switched to swi-prolog.
Most code has been adapted and/or still works, but please let me know if you find anything that's broken.
Thanks! Dave.
General use
  • /usr/bin/prolog is the prolog query engine
  • halt. to quit prolog entirely, (help) for help, abort. to exit the current query (but not prolog entirely).
  • ['filename']. to compile and load an existing file of prolog facts/rules, a list of filenames is acceptable.
  • control-c to interrupt, debug, or get help
    (then a abort, e exit, b break, c continue t trace, d debug, h help)
  • trace. and notrace. to turn on/off tracing
  • graphical version: there is an associate gui prolog: xpce (found at /usr/bin/xpce on our system)
  • prolog scripts can be created using the #! line and the initialization goal, see the example here: tscript.pl

Availability

Overview: Terms Rules, resolution and control
Data types and operations I/O Misc. Advanced topics DCGs: grammars and parsing
General coding examples
List ExamplesOther data structures ComputationOther examplesDCG grammars/language