Mercurial > hg > Applications > Tokio
comparison tm.pl @ 0:cfb7c6b24319
Initial revision
author | kono |
---|---|
date | Thu, 30 Aug 2007 14:57:44 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:cfb7c6b24319 |
---|---|
1 /* | |
2 Copyright (C) 1988,2005, Shinji Kono | |
3 Everyone is permitted to copy and distribute verbatim copies | |
4 of this license, but changing it is not allowed. You can also | |
5 use this wording to make the terms for other programs. | |
6 | |
7 send your comments to kono@ie.u-ryukyu.ac.jp | |
8 */ | |
9 | |
10 % | |
11 % tokio standard macro definition | |
12 % | |
13 % Sat Sep 7 16:45:15 JST 1985 | |
14 % $Header$ | |
15 | |
16 '$define' ( *A :- *A = 1 ). | |
17 '$define' ( not(*A) :- *A = 0 ). | |
18 | |
19 % '$define' ( (A | B) :- A,!,B ). ! = | in some prolog | |
20 | |
21 '$define' (A ; B :- H) | |
22 '$clause' (H :- A) | |
23 '$clause' (H :- B). | |
24 | |
25 '$define' (if A then B else C :- H) | |
26 '$clause' (H :- A,!,B) | |
27 '$clause' (H :- C). | |
28 | |
29 '$define' (if A then B :- H) | |
30 '$clause' (H :- A,!,B) | |
31 '$clause' (H). | |
32 | |
33 '$define' (not(A) :- H) | |
34 '$clause' (H :- A,!,fail) | |
35 '$clause' (H). | |
36 | |
37 '$define' (while A do B :- H) | |
38 '$clause' (H :- A,!,( B && H)) | |
39 '$clause' (H :- empty). | |
40 | |
41 '$define' (A && B) :- A,@true & B. % strong chop | |
42 | |
43 '$define' (fin(A) :- H) | |
44 '$clause' (H :- ifEmpty(A), next(H)). | |
45 | |
46 '$define' (keep(A) :- H) | |
47 '$clause' (H :- ifNotEmpty(A), next(H)). | |
48 | |
49 '$define' (more :- @true). % better than notEmpty? | |
50 | |
51 '$define' (#P :- Q) % |t| | |
52 '$clause' (Q :- P, next(Q)). | |
53 | |
54 '$define' ([](P) :- Q) % |t| | |
55 '$clause' (Q :- P, next(Q)). | |
56 | |
57 '$define' ('||'P :- Q) % Sun Oct 13 16:48:00 JST 1985 | |
58 '$clause' (Q :- (P & true), next(Q)). | |
59 | |
60 '$define' ( {P} :- P ). | |
61 | |
62 '$define' ( A gets B :- keep(@A = B) ). | |
63 | |
64 '$define' ( stable(A) :- A gets A ). | |
65 | |
66 '$define' ( <>P :- true && P). | |
67 | |
68 '$define' ( halt(P) :- # (if P then empty else @true)). | |
69 | |
70 '$define' ( '$CNT'(A) <-- B :- '$CNT'(A) = B ). %% tricky! | |
71 | |
72 % many kind of temporal assignments | |
73 | |
74 '$define' ( A <- B :- C <-- B, fin( A = C) ). | |
75 '$define' ( A <= B :- C <-- B, fin( A := C) ). | |
76 '$define' ( [] <<- B :- true). | |
77 '$define' ( [H|T] <<- B :- C <-- B, fin( H = C), T <<- C). | |
78 '$define' ( [] <== B :- true). | |
79 '$define' ( [H|T] <== B :- C=B,H <== B,T <== C). | |
80 % next two macros are processed in tp.pl | |
81 % '$define' ( A <= B :- C <-- B, fin( A := C) ). | |
82 % '$define' ( *A <= B :- D <-- A, C <-- B, fin( *D := C) ). | |
83 | |
84 '$define' ( skip :- @empty ). | |
85 | |
86 '$define' ( beg(X) :- empty,X & true ). | |
87 | |
88 '$define' (call(H) :- r_tokio_call(H)). | |
89 | |
90 %% system macro end | |
91 | |
92 '$define' ('r_initr_'). |