We illustrate the use of dyalog on a small recursive example that will loop with standard Prolog systems.
% cat pgm.pl
q(f(f(a))).
q(X) :- q(f(X)).
?-q(X). % the query must be inside the file
% dyacc pgm.pl -o pgm
% ./pgm
Answer:
X = f(f(a))
Answer:
X = f(a)
Answer:
X = a