diff --git a/pl/eam.yap b/pl/eam.yap new file mode 100644 index 000000000..0ee3f2b9c --- /dev/null +++ b/pl/eam.yap @@ -0,0 +1,33 @@ +/************************************************************************* +* * +* YAP Prolog * +* * +* Yap Prolog was developed at NCCUP - Universidade do Porto * +* BEAM extends the YAP Prolog system to support the EAM * +* * +* Copyright Ricardo Lopes and Universidade do Porto 2000-2006 * +* * +************************************************************************** +* * +* File: eam.yap * +* Last rev: 6/4/2006 * +* mods: * +* comments: Some utility predicates needed by BEAM * +* * +*************************************************************************/ + +'$_eamtrans'((A,B),(C,D)):- !, '$_eamtrans'(A,C),'$_eamtrans'(B,D). +'$_eamtrans'((X is Y) ,(skip_while_var(Vars), X is Y )):- !, '$variables_in_term'(Y,[],Vars). +'$_eamtrans'((X =\= Y),(skip_while_var(Vars), X =\= Y )):- !, '$variables_in_term'(X + Y,[],Vars). +'$_eamtrans'((X =\= Y),(skip_while_var(Vars), X =:= Y )):- !, '$variables_in_term'(X + Y,[],Vars). +'$_eamtrans'((X >= Y) ,(skip_while_var(Vars), X >= Y )):- !, '$variables_in_term'(X + Y,[],Vars). +'$_eamtrans'((X > Y) ,(skip_while_var(Vars), X > Y )):- !, '$variables_in_term'(X + Y,[],Vars). +'$_eamtrans'((X < Y) ,(skip_while_var(Vars), X < Y )):- !, '$variables_in_term'(X + Y,[],Vars). +'$_eamtrans'((X =< Y) ,(skip_while_var(Vars), X =< Y )):- !, '$variables_in_term'(X + Y,[],Vars). +'$_eamtrans'(B,B). + +eamconsult(File):- eam, eam, %fails if eam is disable + assert((term_expansion((A :- B),(A :- C)):- '$_eamtrans'(B,C))), + eam, ( consult(File) ; true), eam, + retract((term_expansion((A :- B),(A :- C)):- '$_eamtrans'(B,C))). + diff --git a/pl/init.yap b/pl/init.yap index 35f5e7752..567801f33 100644 --- a/pl/init.yap +++ b/pl/init.yap @@ -71,6 +71,7 @@ otherwise. 'strict_iso.yap', 'tabling.yap', 'threads.yap', + 'eam.yap', 'yapor.yap']. :- thread_local([idb:'$debug'/0,idb:'$trace'/0,idb:'$spy_skip'/0,idb:'$spy_stop'/0]).