SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools


PlDoc

You can find the main documentation about PlDoc at the SWI-Site.

Start a separate Prolog process

:!: You can't start the PlDoc server from the PDT console! :!:

On Windows

  • Start plwin

On Linux

  • Open a new terminal
    • Menu path: Anwendungen > Zubehör > Terminal
  • Start a new Prolog process
    • Enter to the console swipl

Start the PlDoc server

  • Tell the process to collect all PlDoc from all consulted predicates.
    • Enter: doc_collect(true).
  • Start the server (on some port, e.g. 8711).
    • Enter: doc_server(8711).

Consult your Prolog files

enter: consult('<full path to prolog file>').

The easiest way: Consult the file in Eclipse and copy-paste the entire consult line as shown at the top of the following snapshot.

And paste it into the terminal window.

(Ok, this second screenshot is fake, but you know what we mean ;-) )

Enjoy your Prolog documentation

  • Open your favorit browser and point it to:
  • Alternatively you could simply enter doc_browser. This does the same.

Conventions

Because it is more familiar, we should use the JavaDoc style. So the example from the SWI site should be for us:

/** length(+List:list, -Length:int) is det.
 *  length(?List:list, -Length:int) is nondet.
 *  length(?List:list, +Length:int) is det.
 *
 *       True if List is a list of length Length.
 *
 *       @compat iso
 */

Expected number of bindings:

determinism number of bindings choice-point after last success
det 1 Forbidden
semidet 0..1 Forbidden
nondet 0..* Allowed
multi 1..* Allowed

Known Bugs

During the first presentation of PlDoc we got “Internal Server” errors telling us, things like “Undefined procedure: $pldoc/4”. It looks like the developer forgot to declare the predicates that he dynamically generates as dynamic. You can easily repair that. Just enter in your console:

dynamic '$pldoc'/4.
dynamic '$mode'/2.

Script

To summarize, here is what you should enter into your console:

doc_collect(true).
doc_server(8711).
doc_browser.
dynamic '$pldoc'/4, '$mode'/2.

Don't forget to consult your prolog code afterwards.

teaching/labs/ese/2010/pldoc.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2021