Using SWI-Prolog pack gvterm

The gvterm pack is designed to use the xdot program to directly see the result interactively. This is a Python script in the scripts directory of the pack. Seems this script does no longer work on recent Linux versions. My Ubuntu 20.04 has xdot as a standard package though, so simply do

sudo apt install xdot

And after that from Prolog

?- [library(gvterm)].
?- dotty_term(a(b,c)).

For most platforms I guess there is some interactive dot viewer. Install it and adjust gvterm.pl to find it and you should be fine.

Finally, you can use gvterm from SWISH. See https://swish.swi-prolog.org/example/render_term.swinb

1 Like