Mercurial > hg > Applications > Tokio
diff tm.pl @ 0:cfb7c6b24319
Initial revision
author | kono |
---|---|
date | Thu, 30 Aug 2007 14:57:44 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tm.pl Thu Aug 30 14:57:44 2007 +0900 @@ -0,0 +1,92 @@ +/* + Copyright (C) 1988,2005, Shinji Kono + Everyone is permitted to copy and distribute verbatim copies + of this license, but changing it is not allowed. You can also + use this wording to make the terms for other programs. + + send your comments to kono@ie.u-ryukyu.ac.jp +*/ + +% +% tokio standard macro definition +% +% Sat Sep 7 16:45:15 JST 1985 +% $Header$ + +'$define' ( *A :- *A = 1 ). +'$define' ( not(*A) :- *A = 0 ). + +% '$define' ( (A | B) :- A,!,B ). ! = | in some prolog + +'$define' (A ; B :- H) +'$clause' (H :- A) +'$clause' (H :- B). + +'$define' (if A then B else C :- H) +'$clause' (H :- A,!,B) +'$clause' (H :- C). + +'$define' (if A then B :- H) +'$clause' (H :- A,!,B) +'$clause' (H). + +'$define' (not(A) :- H) +'$clause' (H :- A,!,fail) +'$clause' (H). + +'$define' (while A do B :- H) +'$clause' (H :- A,!,( B && H)) +'$clause' (H :- empty). + +'$define' (A && B) :- A,@true & B. % strong chop + +'$define' (fin(A) :- H) +'$clause' (H :- ifEmpty(A), next(H)). + +'$define' (keep(A) :- H) +'$clause' (H :- ifNotEmpty(A), next(H)). + +'$define' (more :- @true). % better than notEmpty? + +'$define' (#P :- Q) % |t| +'$clause' (Q :- P, next(Q)). + +'$define' ([](P) :- Q) % |t| +'$clause' (Q :- P, next(Q)). + +'$define' ('||'P :- Q) % Sun Oct 13 16:48:00 JST 1985 +'$clause' (Q :- (P & true), next(Q)). + +'$define' ( {P} :- P ). + +'$define' ( A gets B :- keep(@A = B) ). + +'$define' ( stable(A) :- A gets A ). + +'$define' ( <>P :- true && P). + +'$define' ( halt(P) :- # (if P then empty else @true)). + +'$define' ( '$CNT'(A) <-- B :- '$CNT'(A) = B ). %% tricky! + +% many kind of temporal assignments + +'$define' ( A <- B :- C <-- B, fin( A = C) ). +'$define' ( A <= B :- C <-- B, fin( A := C) ). +'$define' ( [] <<- B :- true). +'$define' ( [H|T] <<- B :- C <-- B, fin( H = C), T <<- C). +'$define' ( [] <== B :- true). +'$define' ( [H|T] <== B :- C=B,H <== B,T <== C). +% next two macros are processed in tp.pl +% '$define' ( A <= B :- C <-- B, fin( A := C) ). +% '$define' ( *A <= B :- D <-- A, C <-- B, fin( *D := C) ). + +'$define' ( skip :- @empty ). + +'$define' ( beg(X) :- empty,X & true ). + +'$define' (call(H) :- r_tokio_call(H)). + + %% system macro end + +'$define' ('r_initr_').