Hessischer Bildungsserver / Arbeitsplattformen

Graphical Terminterpreter for SWI-Prolog

The different data structures of Prolog like atom, list, arithmetic term, fact or rule are internally represented as tree structures. Only for the output different display-formats are used.

For fundamental knowledge and insights into the data structures of Prolog it is didactically meaningful to display the different terms graphically.

The following Terminterpreter plots arbitrary Prolog-terms as a tree structure.

How to use

Download the Terminterpreter (version 1.7, from 2013.09.04) and save the file in the library-folder of SWI-Prolog. The filedate has to be up-to-date. Then call ?- make. in SWI-Prolog, so that afterwards the Terminterpreter can be used like a system-modul.

You can call the Terminterpreter with draw_term/0 for interactive use or with draw_term/1 supplying one term as single argument.

To optimize the displayed tree you can drag the nodes of the tree with the mouse. With doubleclick on the moved node all the sub-nodes are refreshed.