 *****************************************************************************
 *                                                                           *
 *           ILLUSTRATION OF PROGRAM MANIPULATION USING TEYJUS               *
 *                                                                           *
 *  The script that follows shows the execution of the code that implements  *
 *  tail recursion recognition for two argument functional programs. The     *
 *  script is a little cryptic. Looking at the relevant module will reveal   *
 *  that the (tail recursive) factorial and gcd programs are deemed to be    *
 *  tail recursive as expected but the append program is not so recognized.  *
 *  This code demonstrates the power/usefulness of higher-order unification. *
 *                                                                           *
 *  The module tr1_test is assumed to be precompiled in this script.         *
 *                                                                           *
 *****************************************************************************

/* Setting up */

% make tr1
../../../source/tjdepend *.mod > depend
../../../source/tjcc tr1_test
../../../source/tjcc terms
../../../source/tjcc tr_recognizer
../../../source/tjlink tr1_test
% alias tjsim ../../../source/tjsim
%

/* Checking tail recursiveness of some example programs */

% tjsim tr1_test
Welcome to Teyjus
Copyright (C) 2008 A. Gacek, S. Holte, G. Nadathur, X. Qi, Z. Snow
Teyjus comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions. Please view the accompanying file
COPYING for more information
[tr1_test] ?- test 1.

yes

[tr1_test] ?- test 2.

yes

[tr1_test] ?- test 3.

no (more) solutions

[tr1_test] ?- halt.
% 
