Annotation of OpenXM/src/asir-doc/int-parts/parser.texi, Revision 1.3
1.3 ! noro 1: @comment $OpenXM: OpenXM/src/asir-doc/int-parts/parser.texi,v 1.2 2003/04/19 10:36:29 noro Exp $
! 2: @chapter Parser
1.1 noro 3:
1.2 noro 4: \JP @section Parser $B$N9=@.(B
5: \EG @section Configuration of the parser
1.1 noro 6:
1.2 noro 7: \BJP
1.3 ! noro 8: parser $B$O(B Asir $B8@8l$G=q$+$l$?J8;zNs$rCf4V8@8l$KJQ49$9$k(B. parser $B$O(B
1.1 noro 9: $B<!$N$b$N$+$i9=@.$5$l$k(B.
1.2 noro 10: \E
11: \BEG
12: \E
1.1 noro 13:
1.2 noro 14: \BJP
1.1 noro 15: @itemize
16: @item $BJ8K!Dj5A(B
17:
18: Asir $B8@8l$NJ8K!$O(B @code{yacc} $B$N%=!<%9%U%!%$%k$H$7$FDj5A$5$l$F$$$k(B. $B$3$N(B
19: $B%U%!%$%k$O(B @code{yacc} $B$K$h$j(B parser $B%W%m%0%i%`$KJQ49$5$l$k(B.
20:
21: @item $B;z6g2r@O(B
22:
23: yacc $B$G@8@.$5$l$k(B parser $B%W%m%0%i%`$O(B, $BF~NOJ8;zNs$N@hF,$+$i=g$K(B, $BB0@-Kh(B
24: $B$KJ8;zNs$r@Z$jJ,$1$k4X?t(B @code{yylex()} $B$r8F$S=P$7$J$,$i(B, $BJ8K!Dj5A$K=>$C(B
25: $B$FCf4V8@8l(B tree $B$r9=@.$7$F$$$/(B. $B;z6g2r@ODj5A%U%!%$%k$+$i(B @code{yylex()}
26: $B$r@8@.$9$k%W%m%0%i%`(B @code{lex} $B$b$"$k$,(B, Asir $B$G$ONr;KE*$JM}M3$+$i(B
27: C $B8@8l$K$h$jD>@\5-=R$7$F$$$k(B.
28:
29: @item $BL>A04IM}(B
30:
31: @code{yylex()} $B$K$h$C$F@Z$jJ,$1$i$l$kJ8;zNs$H$7$F(B, $B$"$i$+$8$aDj5A$5$l$?(B
32: keyword (@samp{if}, @samp{for} $B$J$I(B) $B$NB>$K(B, $BJQ?tL>(B, $B4X?tL>$J$IF0E*$K(B
33: $B@8@.$5$l$kL>A0$,$"$k(B. $B$3$l$i$OB0@-Kh$K%j%9%H(B, $BG[Ns$J$I$N7A$G4IM}$5$l(B,
34: parser $B$N<B9TCf$K;2>H(B, $BDI2C$J$I$,9T$o$l$k(B.
35: @end itemize
1.2 noro 36: \E
1.1 noro 37:
1.2 noro 38: \BEG
39: @itemize
40: @item
41:
42: @item
43:
44: @item
45:
46: @end itemize
47: \E
1.1 noro 48:
1.2 noro 49: \JP @section $BCf4V8@8l(B
50: \EG @section Intermediate language
51:
52: \BJP
1.1 noro 53: @example
54: typedef struct oFNODE @{ $B<0$rI=$9%N!<%I(B
55: fid id; $B<1JL;R(B
56: pointer arg[1]; $B0z?tG[Ns(B ($BD9$52DJQ(B)
57: @} oFNODE *FNODE;
58:
59: typedef struct oSNODE @{ $BJ8$rI=$9%N!<%I(B
60: sid id; $B<1JL;R(B
61: int ln; $B9THV9f(B
62: pointer arg[1]; $B0z?tG[Ns(B ($BD9$52DJQ(B)
63: @} oSNODE *SNODE;
64: @end example
1.2 noro 65: \E
66: \BEG
67: @example
68: typedef struct oFNODE @{
69: fid id;
70: pointer arg[1];
71: @} oFNODE *FNODE;
1.1 noro 72:
1.2 noro 73: typedef struct oSNODE @{
74: sid id;
75: int ln;
76: pointer arg[1];
77: @} oSNODE *SNODE;
78: @end example
79: \E
80:
81: \BJP
1.1 noro 82: interpreter $B$NF~NO$H$J$kCf4V8@8l$N9=@.$O6K$a$FC1=c$G$"$k(B.
83: $BCf4V8@8l$N9=@.MWAG$O(B @b{$BJ8(B} $B$*$h$S(B @b{$B<0(B} $B$G$"$k(B.
84: Asir $B8@8l$K$h$kF~NOJ8;zNs$O(B, $BJ8$NJB$S$H$7$F(B parse $B$5$l(B,
85: @code{SNODE} $B9=B$BN$N%j%9%H$KJQ49$5$l$k(B. $BJ8$N<oN`$O<1JL;R(B @code{id}
86: $B$K$h$j<($5$l$k(B. $B0z?tG[Ns$OJ8$N<oN`$K1~$8$FD9$5(B, $B$*$h$S$=$N3FMWAG$N(B
87: $B0UL#(B($BLr3d(B)$B$,7h$^$k(B. $B0J2<$G(B @code{S_} $B$G;O$^$k$N$O<1JL;R$NL>A0$G(B,
88: $B<B:]$K$OAj0[$J$k@0?t$,3d$jEv$F$i$l$F$$$k(B.
89: @samp{|} $B$O(B, $B<1JL;R$*$h$S0z?t$N;E@Z$j$r<($9(B.
1.2 noro 90: \E
1.1 noro 91:
92: @table @code
1.2 noro 93: @item S_SINGLE | expr
1.1 noro 94:
1.2 noro 95: \JP @samp{expr}$B$r<B9T$9$k(B.
96: \EG
1.1 noro 97:
98: @item S_BREAK
99:
1.2 noro 100: \JP $B:G$bFbB&$N%k!<%W(B (@code{S_FOR}, @code{S_DO}) $B$rH4$1$k(B.
101: \EG
1.1 noro 102:
103: @item S_CONTINUE
104:
1.2 noro 105: \JP $B:G$bFbB&$N%k!<%W$N@hF,$KHt$V(B.
106: \EG
1.1 noro 107:
1.2 noro 108: @item S_RETURN | expr
1.1 noro 109:
1.2 noro 110: \JP $B4X?t$+$iH4$1$F(B, @samp{expr} $B$NCM$rJV$9(B.
111: \EG
1.1 noro 112:
1.2 noro 113: @item S_IFELSE | dummy | expr | stat1 | stat2
1.1 noro 114:
1.2 noro 115: \JP@samp{expr} $B$NCM$,(B 0 $B$G$J$$$J$i(B @samp{stat 1} $B$r<B9T(B, 0 $B$J$i(B @samp{stat 2} $B$r(B
1.1 noro 116: $B<B9T(B.
1.2 noro 117: \EG
1.1 noro 118:
1.2 noro 119: @item S_FOR | dummy | expr1 | expr | stat | expr2
1.1 noro 120:
1.2 noro 121: \BJP
122: $B$^$:(B @samp{expr1} $B$r<B9T$7$?$"$H(B, @samp{expr} $B$NCM$,(B 0 $B$G$J$$4V(B, @samp{stat}
123: $B$H(B @samp{expr2} $B$N7W;;$r7+$jJV$9(B.
124: \E
125: \BEG
126: \E
1.1 noro 127:
1.2 noro 128: @item S_DO | dummy | stat | expr
129:
130: \JP @samp{stat} $B$r<B9T$7$?$"$H(B @samp{expr} $B$r7W;;$7(B, $B$=$NCM$,(B 0 $B$G$J$$4V7+$jJV$9(B.
131: \EG
1.1 noro 132:
133: @end table
134:
1.2 noro 135: \BJP
1.1 noro 136: @code{SNODE} $B$O9THV9f$r<($9%a%s%P(B @code{ln} $B$r;}$D(B. $B3F9T$,%U%!%$%k$+$iFI$^$l$?(B
137: $B>l9g$K(B, $B$=$N%U%!%$%k$K$*$1$k9THV9f$r3JG<$7$F$*$/(B. $B$3$l$O%G%P%C%0;~$K9THV9f(B
138: $B$+$iJ8$rFCDj$9$k$?$a$J$I$KMQ$$$i$l$k(B.
139:
140: $BJ8$KBP$9$kCf4V8@8lDj5A$GJ,$+$k$h$&$K(B, $BJ8$O:G=*E*$K$O<0$+$i9=@.$5$l$F$$$k(B.
141: $BJ8Cf$K8=$l$?<0$O(B, parser $B$K$h$C$F2r@O$5$l(B, @code{FNODE} $B9=B$BN$N%j%9%H$K(B
142: $BJQ49$5$l$k(B. $B<0$N<oN`$O<1JL;R(B @code{id}$B$K$h$j<($5$l$k(B. $B0z?tG[Ns$O<0$N<oN`(B
143: $B$K1~$8$FD9$5(B, $B$*$h$S$=$N3FMWAG$N0UL#(B($BLr3d(B)$B$,7h$^$k(B. $B0J2<$G(B @code{I_} $B$G(B
144: $B;O$^$k$N$O<1JL;R$NL>A0$G(B, $B<B:]$K$OAj0[$J$k@0?t$,3d$jEv$F$i$l$F$$(B
145: $B$k(B. @samp{|} $B$O(B, $B<1JL;R$*$h$S0z?t$N;E@Z$j$r<($9(B.
1.2 noro 146: \E
147: \BEG
148: \E
1.1 noro 149:
150: @table @code
1.2 noro 151: @item I_STR | string
1.1 noro 152:
1.2 noro 153: \JP $BJ8;zNs(B
154: \EG
1.1 noro 155:
1.2 noro 156: @item I_FORMULA | object
1.1 noro 157:
1.2 noro 158: \JP $B4{$K(B Risa object $B$KJQ49$5$l$F$$$k(B \code{object}
159: \EG
1.1 noro 160:
1.2 noro 161: @item I_ANS | index
1.1 noro 162:
1.2 noro 163: \JP @samp{index} $BHVL\$N7W;;7k2L(B
164: \EG
1.1 noro 165:
166: @item I_GF2NGEN
167:
1.2 noro 168: \JP $BI8?t(B 2 $BM-8BBN$N@8@.85(B
169: \EG
1.1 noro 170:
1.2 noro 171: @item I_EV | node
1.1 noro 172:
1.2 noro 173: \JP @samp{node} $B$r;X?t%Y%/%H%k$H$_$F(B, $B78?t(B 1 $B$NC19`<0$r@8@.$9$k(B.
174: \EG
1.1 noro 175:
1.2 noro 176: @item I_FUNC | function | argument list
1.1 noro 177:
1.2 noro 178: \JP $B4X?t8F$S=P$7(B
179: \EG
1.1 noro 180:
1.2 noro 181: @item I_CAR | list
1.1 noro 182:
1.2 noro 183: \JP @code{list} $B$N@hF,MWAG(B
184: \EG
1.1 noro 185:
1.2 noro 186: @item I_CDR | list
1.1 noro 187:
1.2 noro 188: \JP @code{list} $B$+$i@hF,MWAG$r=|$$$?%j%9%H(B
189: \EG
1.1 noro 190:
1.2 noro 191: @item I_PVAR | index
1.1 noro 192:
1.2 noro 193: \JP @code{index} $BHVL\$N%W%m%0%i%`JQ?t$NCM(B
194: \EG
1.1 noro 195:
1.2 noro 196: @item I_ASSPVAR | expr1 | expr2
1.1 noro 197:
1.2 noro 198: \JP @samp{expr1} $B$G<($5$l$k%W%m%0%i%`JQ?t$K(B @samp{expr2} $B$rBeF~(B
199: \EG
1.1 noro 200:
1.2 noro 201: @item I_INDEX | expr | index
1.1 noro 202:
1.2 noro 203: \JP @samp{expr} $B$rG[Ns$^$?$O%j%9%H$H8+$F(B, @samp{index}$B$G;XDj$5$l$kMWAG$r<h$j=P$9(B.
204: \EG
1.1 noro 205:
1.2 noro 206: @item I_POSTSELF | function | expr
1.1 noro 207:
1.2 noro 208: \BJP
209: @samp{expr} $B$NCM$r<h$j=P$7$?$"$H(B, @samp{function} $B$,2C;;$J$i(B @samp{expr} $B$r(B 1 $BA}$d$7(B,
210: @samp{function} $B$,8:;;$J$i(B @samp{expr} $B$r(B 1 $B8:$i$9(B.
211: \E
212: \BEG
213: \E
1.1 noro 214:
1.2 noro 215: @item I_PRESELF | function | expr
1.1 noro 216:
1.2 noro 217: \BJP
218: @samp{function} $B$,2C;;$J$i(B @samp{expr} $B$r(B 1 $BA}$d$7(B, @samp{function} $B$,8:;;$J$i(B
219: @samp{$B<0(B} $B$r(B 1 $B8:$i$9(B. $B$=$N8e(B @samp{expr} $B$NCM$r<h$j=P$9(B.
220: \E
221: \BEG
222: \E
1.1 noro 223:
1.2 noro 224: @item I_LIST | node
1.1 noro 225:
1.2 noro 226: \JP @samp{node}$B$+$i%j%9%H$r@8@.$9$k(B.
227: \EG
1.1 noro 228:
1.2 noro 229: @item I_NOP | expr
1.1 noro 230:
1.2 noro 231: \JP @samp{expr} $B$,(B 0 $B$G$J$$$J$i(B 0, 0 $B$J$i(B 1.
232: \EG
1.1 noro 233:
1.2 noro 234: @item I_OR | expr1 | expr2
1.1 noro 235:
1.2 noro 236: \JP @samp{expr1}, @samp{expr2} $B$,$H$b$K(B 0 $B$J$i(B 0, $B$=$l0J30$O(B 1.
237: \EG
1.1 noro 238:
1.2 noro 239: @item I_AND | expr1 | expr2
1.1 noro 240:
1.2 noro 241: \JP @samp{expr1}, @samp{expr2} $B$,$H$b$K(B 0 $B$G$J$$$J$i(B 1, $B$=$l0J30$O(B 0.
242: \EG
1.1 noro 243:
1.2 noro 244: @item I_CE | expr | expr1 | expr2
1.1 noro 245:
1.2 noro 246: \JP @samp{expr} $B$,(B 0 $B$G$J$$$H$-(B @samp{expr1} $B$NCM(B, 0 $B$N$H$-(B @samp{expr2} $B$NCM(B.
247: \EG
1.1 noro 248:
1.2 noro 249: @item I_BOP | bop_id | expr1 | expr2
1.1 noro 250:
1.2 noro 251: \BJP
252: @samp{bop_id} $B$G;XDj$5$l$kFs9`1i;;;R(B ($B2C8:>h=|$J$I(B) $B$K=>$C$F(B, @samp{expr1},
253: @samp{expr2} $B$r0z?t$H$7$F1i;;(B.
254: \E
255: \BEG
256: \E
1.1 noro 257:
1.2 noro 258: @item I_COP | cop_id | expr1 | expr2
1.1 noro 259:
1.2 noro 260: \BJP
261: @samp{cop_id} $B$G;XDj$5$l$kHf3S1i;;;R$K=>$C$F(B, @samp{expr1},
262: @samp{expr2} $B$rHf3S(B. $B7k2L$O(B 0, 1, -1.
263: \E
264: \BEG
265: \E
1.1 noro 266:
1.2 noro 267: @item I_LOP | lop_id | expr1 | expr2
1.1 noro 268:
1.2 noro 269: \BJP
270: @samp{lop_id} $B$G;XDj$5$l$kO@M}1i;;;R$K$h$j(B, @samp{expr1},
271: @samp{expr2} $B$r0z?t$H$7$FO@M}<0$r@8@.(B.
272: \E
273: \BEG
274: \E
1.1 noro 275: @end table
276:
1.2 noro 277: \JP @section $B;z6g2r@O(B
278: \EG @section Lexical analysis
1.1 noro 279:
1.2 noro 280: \BJP
1.1 noro 281: $B;z6g2r@OIt$G$O(B, $B6uGr(B, $B%?%V(B, $B2~9T$r%9%-%C%W$7$?$"$H$N:G=i$NJ8;z$K$h$C$F(B
282: $B:G=i$NJ,N`$r9T$&(B.
1.2 noro 283: \E
284: \BEG
285: \E
1.1 noro 286:
287: @itemize @bullet
1.2 noro 288: \BJP
1.1 noro 289: @item 0
290:
291: $BB3$/(B 0 $B$r%9%-%C%W$7$F(B, $B?t;z$,Mh$?$i(B 10 $B?J?t(B, b $B$,Mh$?$i(B 2 $B?J?t(B, x $B$,Mh$?$i(B
292: 16 $B?J?t$H$7$F(B, $B$"$H$KB3$/(B valid $B$JJ8;z$r%P%C%U%!$KFI$_9~$_(B, 2^32 $B?J?t$K(B
293: $BJQ49$9$k(B.
294:
295: @item 0 $B0J30$N?t;z(B
296:
297: $B0J2<$KB3$/?t;z$r%P%C%U%!$KFI$_9~$_(B, 10 $B?J?t$H$7$F(B 2^32 $B?J?t$KJQ49$9$k(B.
298:
299: @item $B1Q>.J8;z(B
300:
301: $B0J2<$KB3$/(B, $B%"%k%U%!%Y%C%H(B, $B?t;z(B, @samp{_} $B$r%P%C%U%!$KFI$_9~$_(B, keyword
302: $B$N>l9g$K$O$=$N<1JL;R(B, $B$=$&$G$J$$>l9g$K$O(B @samp{$B>.J8;z$G;O$^$kJ8;zNs(B} $B$r0UL#(B
303: $B$9$k<1JL;R$rJV$9(B.
304:
305: @item $B1QBgJ8;z(B
306:
307: $B0J2<$KB3$/(B, $B%"%k%U%!%Y%C%H(B, $B?t;z(B, @samp{_} $B$r%P%C%U%!$KFI$_9~$_(B,
308: @samp{$BBgJ8;z$G;O$^$kJ8;zNs(B} $B$r0UL#$9$k<1JL;R$rJV$9(B.
309:
310: @item @code{@@}
311:
312: @code{@@} $B$O$=$N8e$KMh$kJ8;zNs$K$h$j$5$^$6$^$JBP>]$rI=$9(B.
313:
314: @itemize @code{-}
315: @item @code{@@@@}
316:
317: $BD>A0$N7W;;7k2L(B
318:
319: @item @code{@@pi}
320:
321: $B1_<~N($rI=$9ITDj85(B
322: @item @code{@@e}
323:
324: $B<+A3BP?t$NDl$rI=$9ITDj85(B
325:
326: @item @code{@@i}
327:
328: $B5u?tC10L(B
329:
330: @item @code{@@p}
331:
332: $B4qI8?tM-8BBN$N3HBgBN$N@8@.85(B
333:
334: @item @code{@@true}, @code{@@false}, @code{@@impl}, @code{@@repl}, @code{@@equiv}
335:
336: $BO@M}1i;;;R(B
337: @end itemize
338:
339: $B$3$l0J30$N>l9g(B @code{@@} $B$OI8?t(B 2 $B$NM-8BBN$N@8@.85$rI=$9(B.
340:
341: @item @samp{"}
342:
343: $B<!$N(B @samp{"} $B$ND>A0$NJ8;z$^$G$rJ8;zNs(B Risa object $B$H$_$J$9(B.
344:
345: @item @samp{'}
346:
347: $B<!$N(B @samp{'} $B$ND>A0$NJ8;z$^$G$r(B @samp{$B>.J8;z$G;O$^$kJ8;zNs(B} $B$H$_$J$9(B.
348: $B$3$l$O(B, $BG$0UJ8;zNs$rL>A0$H$9$kITDj85$r@8@.$9$kI,MW$,$"$k>l9g$J$I$K(B
349: $BMQ$$$k(B.
350:
351: @item $B$=$NB>$N5-9f(B
352:
353: $B5-9f$K1~$8$F$5$^$6$^$K07$o$l$k(B. $BB?$/$O1i;;;R$H$7$F07$o$l$k$,(B,
354: @samp{@{}, @samp{@}}, @samp{[}, @samp{]}, @samp{(}, @samp{)}
355: $B$J$I(B, $B0lBP$G4V$K$"$kBP>]$K:nMQ$9$k$b$N$b$"$k(B.
1.2 noro 356: \E
357: \BEG
358: @item 0
359:
360: $BB3$/(B 0 $B$r%9%-%C%W$7$F(B, $B?t;z$,Mh$?$i(B 10 $B?J?t(B, b $B$,Mh$?$i(B 2 $B?J?t(B, x $B$,Mh$?$i(B
361: 16 $B?J?t$H$7$F(B, $B$"$H$KB3$/(B valid $B$JJ8;z$r%P%C%U%!$KFI$_9~$_(B, 2^32 $B?J?t$K(B
362: $BJQ49$9$k(B.
363:
364: @item 0 $B0J30$N?t;z(B
365:
366: $B0J2<$KB3$/?t;z$r%P%C%U%!$KFI$_9~$_(B, 10 $B?J?t$H$7$F(B 2^32 $B?J?t$KJQ49$9$k(B.
367:
368: @item $B1Q>.J8;z(B
369:
370: $B0J2<$KB3$/(B, $B%"%k%U%!%Y%C%H(B, $B?t;z(B, @samp{_} $B$r%P%C%U%!$KFI$_9~$_(B, keyword
371: $B$N>l9g$K$O$=$N<1JL;R(B, $B$=$&$G$J$$>l9g$K$O(B @samp{$B>.J8;z$G;O$^$kJ8;zNs(B} $B$r0UL#(B
372: $B$9$k<1JL;R$rJV$9(B.
373:
374: @item $B1QBgJ8;z(B
375:
376: $B0J2<$KB3$/(B, $B%"%k%U%!%Y%C%H(B, $B?t;z(B, @samp{_} $B$r%P%C%U%!$KFI$_9~$_(B,
377: @samp{$BBgJ8;z$G;O$^$kJ8;zNs(B} $B$r0UL#$9$k<1JL;R$rJV$9(B.
378:
379: @item @code{@@}
380:
381: @code{@@} $B$O$=$N8e$KMh$kJ8;zNs$K$h$j$5$^$6$^$JBP>]$rI=$9(B.
382:
383: @itemize @code{-}
384: @item @code{@@@@}
385:
386: $BD>A0$N7W;;7k2L(B
387:
388: @item @code{@@pi}
389:
390: $B1_<~N($rI=$9ITDj85(B
391: @item @code{@@e}
392:
393: $B<+A3BP?t$NDl$rI=$9ITDj85(B
394:
395: @item @code{@@i}
396:
397: $B5u?tC10L(B
398:
399: @item @code{@@p}
400:
401: $B4qI8?tM-8BBN$N3HBgBN$N@8@.85(B
402:
403: @item @code{@@true}, @code{@@false}, @code{@@impl}, @code{@@repl}, @code{@@equiv}
404:
405: $BO@M}1i;;;R(B
1.1 noro 406: @end itemize
407:
1.2 noro 408: $B$3$l0J30$N>l9g(B @code{@@} $B$OI8?t(B 2 $B$NM-8BBN$N@8@.85$rI=$9(B.
409:
410: @item @samp{"}
411:
412: $B<!$N(B @samp{"} $B$ND>A0$NJ8;z$^$G$rJ8;zNs(B Risa object $B$H$_$J$9(B.
413:
414: @item @samp{'}
1.1 noro 415:
1.2 noro 416: $B<!$N(B @samp{'} $B$ND>A0$NJ8;z$^$G$r(B @samp{$B>.J8;z$G;O$^$kJ8;zNs(B} $B$H$_$J$9(B.
417: $B$3$l$O(B, $BG$0UJ8;zNs$rL>A0$H$9$kITDj85$r@8@.$9$kI,MW$,$"$k>l9g$J$I$K(B
418: $BMQ$$$k(B.
419:
420: @item $B$=$NB>$N5-9f(B
421:
422: $B5-9f$K1~$8$F$5$^$6$^$K07$o$l$k(B. $BB?$/$O1i;;;R$H$7$F07$o$l$k$,(B,
423: @samp{@{}, @samp{@}}, @samp{[}, @samp{]}, @samp{(}, @samp{)}
424: $B$J$I(B, $B0lBP$G4V$K$"$kBP>]$K:nMQ$9$k$b$N$b$"$k(B.
425: \E
426: @end itemize
427:
428: \JP @section $BL>A04IM}(B
429: \EG @section Names
430:
431: \BJP
1.1 noro 432: Asir $B$K$*$$$F$O(B, $BITDj85(B, $B4X?t(B, $B%W%m%0%i%`JQ?t$H$$$&(B 3 $B$D$N%+%F%4%jJL$K(B
433: $BL>A0$,4IM}$5$l$F$$$k(B.
1.2 noro 434: \E
435: \BEG
436: \E
1.1 noro 437:
1.2 noro 438: \JP @subsection $BITDj85(B
439: \EG @subsection Indeterminates
1.1 noro 440:
1.2 noro 441: \BJP
1.1 noro 442: $BITDj85$OJQ?t%j%9%H(B @code{CO} (Current variable Order) $B$G4IM}$5$l$k(B. $BITDj(B
443: $B85$HG'<1$5$l$kJ8;zNs$,;z6g2r@OIt$+$iM?$($i$l$?>l9g(B, @code{CO} $B$KEPO?$5$l(B
444: $B$F$$$kITDj85$NL>A0$H$=$NJ8;zNs$r=g$KHf3S$7(B, $B0lCW$7$?>l9g$K$O$=$NITDj859=(B
445: $BB$BN%]%$%s%?$rBP1~$9$kJQ?t$H$7$FMQ$$$k(B. $B0lCW$9$kL>A0$,$J$$>l9g$K$O?7$?$K(B
446: $BITDj859=B$BN$r@8@.$7(B, $BM?$($i$l$?J8;zNs$rL>A0$H$7$FEPO?$7(B, @code{CO} $B$N(B
447: $BKvHx$KDI2C$9$k(B.
1.2 noro 448: \E
449: \BEG
450: \E
1.1 noro 451:
1.2 noro 452: \JP @subsection $B4X?t(B
453: \EG @subsection Functions
1.1 noro 454:
455: @example
1.2 noro 456: \BJP
457: typedef struct oFUNC @{ Asir $B4X?t(B
458: char *name; $B4X?tL>(B
459: int argc; $B0z?t$N8D?t(B
460: int type; PARI $B4X?t7?(B
461: aid id; $B7?(B ($BL$Dj5A(B, $BAH$_9~$_(B, $B%f!<%6(B, $B=c(B, PARI)
462: union @{
463: void (*binf)(); $BAH$_9~$_4X?t(B
464: struct oUSRF *usrf; $B%f!<%6Dj5A4X?t9=B$BN(B
465: struct oPF *puref; $B=c4X?t(B
466: @} f;
467: @} *FUNC;
468:
469: typedef struct oUSRF @{ $B%f!<%6Dj5A4X?t(B
470: char *fname; $B4X?tL>(B
471: short vol; $BL$;HMQ(B
472: int startl,endl; $B%U%!%$%kFb$G$N3+;O(B, $B=*N;0LCV(B
473: NODE args; $B2>0z?t%j%9%H(B
474: VS pvs; $B6I=j%W%m%0%i%`JQ?tG[Ns(B
475: char *desc; $B4X?t$N@bL@(B
476: struct oSNODE *body; $BJ8%j%9%H(B($B4X?tK\BN(B)
477: @} *USRF;
478:
479: typedef struct oPF @{ $B=c4X?t(B
480: char *name; $B4X?tL>(B
481: int argc; $B0z?t$N8D?t(B
482: Obj body; $B%f!<%6Dj5A=c4X?t$NK\BN(B
483: V *args; $B0z?tG[Ns(B
484: Obj *deriv; $BJPF34X?tG[Ns(B
485: NODE ins; $B4X?t%$%s%9%?%s%9%j%9%H(B
486: int (*pari)(); PARI $B8F$S=P$74X?t(B
487: double (*libm)(); C $B?t3X4X?t(B
488: int (*simplify)(); simplifier
489: @} *PF;
490:
491: struct oV @{ $BITDj85(B($B:F7G(B)
492: char *name;
493: pointer attr; $BB0@-(B
494: pointer priv;
495: @};
496:
497: extern NODE sysf,noargsysf; $BAH$_9~$_4X?t%j%9%H(B
498: extern NODE usrf; $B%f!<%6Dj5A4X?t%j%9%H(B
499: extern NODE parif; PARI $B4X?t%j%9%H(B
500: extern NODE pflist; $B=c4X?t%j%9%H(B
501: \E
502: \BEG
1.1 noro 503: typedef struct oFUNC @{ Asir $B4X?t(B
504: char *name; $B4X?tL>(B
505: int argc; $B0z?t$N8D?t(B
506: int type; PARI $B4X?t7?(B
507: aid id; $B7?(B ($BL$Dj5A(B, $BAH$_9~$_(B, $B%f!<%6(B, $B=c(B, PARI)
508: union @{
509: void (*binf)(); $BAH$_9~$_4X?t(B
510: struct oUSRF *usrf; $B%f!<%6Dj5A4X?t9=B$BN(B
511: struct oPF *puref; $B=c4X?t(B
512: @} f;
513: @} *FUNC;
514:
515: typedef struct oUSRF @{ $B%f!<%6Dj5A4X?t(B
516: char *fname; $B4X?tL>(B
517: short vol; $BL$;HMQ(B
518: int startl,endl; $B%U%!%$%kFb$G$N3+;O(B, $B=*N;0LCV(B
519: NODE args; $B2>0z?t%j%9%H(B
520: VS pvs; $B6I=j%W%m%0%i%`JQ?tG[Ns(B
521: char *desc; $B4X?t$N@bL@(B
522: struct oSNODE *body; $BJ8%j%9%H(B($B4X?tK\BN(B)
523: @} *USRF;
524:
525: typedef struct oPF @{ $B=c4X?t(B
526: char *name; $B4X?tL>(B
527: int argc; $B0z?t$N8D?t(B
528: Obj body; $B%f!<%6Dj5A=c4X?t$NK\BN(B
529: V *args; $B0z?tG[Ns(B
530: Obj *deriv; $BJPF34X?tG[Ns(B
531: NODE ins; $B4X?t%$%s%9%?%s%9%j%9%H(B
532: int (*pari)(); PARI $B8F$S=P$74X?t(B
533: double (*libm)(); C $B?t3X4X?t(B
534: int (*simplify)(); simplifier
535: @} *PF;
536:
537: struct oV @{ $BITDj85(B($B:F7G(B)
538: char *name;
539: pointer attr; $BB0@-(B
540: pointer priv;
541: @};
542:
543: extern NODE sysf,noargsysf; $BAH$_9~$_4X?t%j%9%H(B
544: extern NODE usrf; $B%f!<%6Dj5A4X?t%j%9%H(B
545: extern NODE parif; PARI $B4X?t%j%9%H(B
546: extern NODE pflist; $B=c4X?t%j%9%H(B
1.2 noro 547: \E
1.1 noro 548: @end example
549:
1.2 noro 550: \BJP
1.1 noro 551: $B4X?t$K$O(B, $BAH$_9~$_4X?t(B, $B%f!<%6Dj5A4X?t(B, PARI $B4X?t$*$h$S=c4X?t$,$"$k(B. $B$$(B
552: $B$:$l$b(B $B4X?t9=B$BN(B @code{FUNC} $B$H$7$FEPO?$5$l%j%9%H$H$7$FJ];}$5$l$k(B. $BAH$_(B
553: $B9~$_4X?t$N$&$A(B, $B0z?t$r;}$D$b$N$O(B, @code{sysf} $B$K(B, $B;}$?$J$$$b$N$O(B
554: @code{noargsysf} $B$KEPO?$5$l$k(B.
555:
556: $B%f!<%6Dj5A4X?t$O(B, $B8F$S=P$7;~$"$k$$$O4X?tDj5A;~$K(B, @code{usrf} $B$r8!:w$7(B,
557: $B%j%9%HCf$K$=$NL>$N4X?t$,$J$$>l9g$K(B @code{FUNC} $B9=B$BN$,@8@.$5$l(B, $B%j%9%H$K(B
558: $BDI2C$5$l$k(B. $B4X?tDj5A$,9T$o$l$kA0$K8F$S=P$7$,9T$o$l$?>l9g(B, @code{FUNC}
559: $B9=B$BN$N%a%s%P(B @code{id} $B$K$O(B, $BL$Dj5A$r0UL#$9$k<1JL;R$,%;%C%H$5$l$k(B.
560: $B8e$K<B:]$K4X?tDj5A$,9T$o$l$?:]$K(B, $B$3$N%a%s%P$O%f!<%6Dj5A4X?t$r0UL#$9$k(B
561: $B<1JL;R$G>e=q$-$5$l(B, $B$=$NB>$N%a%s%P$bA3$k$Y$/%;%C%H$5$l$k(B. $B4{$KDj5A(B
562: $B$5$l$F$$$k>l9g$K$O(B, $B$3$l$i$N%a%s%P$O>e=q$-$5$l$k(B. $BB($A(B, $BF10l4X?tL>(B
563: $B$G$O:G?7$NDj5A$,MQ$$$i$l$k(B.
564:
565: PARI $B4X?t$O(B, $B<B:]$N7W;;$K(B PARI $B%i%$%V%i%j$rMQ$$$k$H$$$&E@$r=|$1$P(B,
566: $BAH$_9~$_4X?t$HF1Ey$G$"$k(B. $B$?$@$7(B, PARI $B%i%$%V%i%j$O(B PARI bigfloat
567: $B$r7k2L$H$7$FJV$9$N$G(B, double float $B$N7k2L$rF@$?$$>l9g$N$?$a$K(B,
568: C $B$N(B @code{libm} $B%i%$%V%i%j$NF1Ey$N4X?t%]%$%s%?$rJ];}$7$F$$$k(B.
569:
570: $BAH$_9~$_(B, $B%f!<%6Dj5A(B, PARI $B4X?t$O(B, $B0z?t$rMQ$$$F7W;;$r9T$$(B, Risa object
571: $B$r7k2L$H$7$FJV$9(B, $BDL>o$N%W%m%0%i%_%s%08@8l$N0UL#$G$N4X?t$@$,(B, $B=c4X?t$O(B,
572: $B0z?t$N$_$,I>2A$5$l$F(B, $B$=$N0z?t$r;}$D4X?t8F$S=P$7$=$N$b$N$rJV$9(B.
573: Asir $B$N<B9TNc$r<($9(B.
1.2 noro 574: \E
575: \BEG
576: \E
1.1 noro 577:
578: @example
579: [0] A=sin(x);
580: sin(x);
581: [1] type(A);
1.2 noro 582: \JP 2 <--- $B=c4X?t$OB?9`<0(B
583: \EG 2 <---
1.1 noro 584: [2] vtype(A);
1.2 noro 585: \JP 2 <--- $BB0@-$O=c4X?t(B
586: \EG 2 <---
1.1 noro 587: [3] args(A);
1.2 noro 588: \JP [x] <--- $B0z?t%j%9%H(B
589: \EG [x] <---
1.1 noro 590: [4] B=functor(A);
1.2 noro 591: \JP sin <--- $B4X?t;R(B
592: \EG sin <---
1.1 noro 593: [5] type(B);
1.2 noro 594: \JP 2 <--- $B4X?t;R$bB?9`<0(B
595: \EG 2 <---
1.1 noro 596: [4] vtype(B);
1.2 noro 597: \JP 3 <--- $BB0@-$O4X?t;R(B
598: \EG 3 <---
1.1 noro 599: @end example
600:
1.2 noro 601: \BJP
1.1 noro 602: $B$3$NNc$G$O(B, @code{sin(x)} $B$J$k=c4X?t$,@8@.$5$l$F$$$k$,(B, Risa object $B$H$7(B
603: $B$F$O(B, @code{sin(x)} $B<+?H$,ITDj85(B, $BB($AB?9`<0$H$J$k(B. $B$7$+$7(B @code{V} $B9=B$(B
604: $BBN$H$7$F$NB0@-(B ($B%a%s%P(B @code{attr}) $B$NCM$,0[$J$k(B. $B$3$NCM$,=c4X?t$r0UL#$9(B
605: $B$k$H$-(B, $B%a%s%P(B @code{priv} $B$K$O$3$N=c4X?t$K4X$9$k$5$^$6$^$J>pJs$,3JG<$5(B
606: $B$l(B, @code{args}, @code{functor} $B$K$h$j<hF@$5$l$k(B. $B4X?t;R<+?H$b(B, Risa
607: object $B$H$7$F$OITDj85$H$7$FB8:_$9$k(B. $B$3$N>l9g$bB0@-$K$h$j4X?t;R$G$"$k(B
608: $B$3$H$,<($5$l$k(B.
1.2 noro 609: \E
610: \BEG
611: \E
1.1 noro 612:
1.2 noro 613: \JP @subsection $B%W%m%0%i%`JQ?t(B
614: \EG @subsection Program variables
1.1 noro 615:
616: @example
1.2 noro 617: \BJP
1.1 noro 618: typedef struct oVS @{ $B%W%m%0%i%`JQ?tG[Ns(B
619: unsigned int n; $B8=:_4^$^$l$kJQ?t$N8D?t(B
620: unsigned int asize; $B3d$jEv$F$i$l$?G[Ns$ND9$5(B
621: unsigned int at;
622: unsigned int level;
623: struct oFUNC *usrf;
624: struct oPV *va; $BG[NsK\BN(B
625: NODE opt; $BL$;HMQ(B
626: @} *VS;
627:
628: typedef struct oPV @{ $B%W%m%0%i%`JQ?t(B
629: char *name; $BJQ?tL>(B
630: sort attr,type;
631: pointer priv;
632: @} *PV;
633:
634: extern VS GPVS; $BBg0hJQ?tG[Ns(B
635: extern VS CPVS; $B8=:_$NJQ?tG[Ns(B
636: extern VS EPVS; extern $B@k8@$5$l$?JQ?tG[Ns(B
637: extern VS APVS; $B7W;;7k2L$r3JG<$9$kG[Ns(B
1.2 noro 638: \E
639: \BEG
640: typedef struct oVS @{
641: unsigned int n;
642: unsigned int asize;
643: unsigned int at;
644: unsigned int level;
645: struct oFUNC *usrf;
646: struct oPV *va;
647: NODE opt;
648: @} *VS;
649:
650: typedef struct oPV @{
651: char *name;
652: sort attr,type;
653: pointer priv;
654: @} *PV;
655:
656: extern VS GPVS;
657: extern VS CPVS;
658: extern VS EPVS;
659: extern VS APVS;
660: \E
1.1 noro 661: @end example
662:
1.2 noro 663: \BJP
1.1 noro 664: Asir $B$K$*$$$F$O(B, $B%W%m%0%i%`JQ?t$N%9%3!<%W$O(B, $BBg0hJQ?t$H(B, $B%W%m%0%i%`Fb$G(B
665: $B$N6I=jJQ?t$N(B 2 $B%l%Y%k$KC1=c2=$5$l$F$$$k(B. $BJQ?t$O(B, $B8=$l$?;~E@$G$$$:$l$+$N(B
666: $B%W%m%0%i%`JQ?t$H$7$FEPO?$5$l$k(B. $B4X?t$N30$G8=$l$?%W%m%0%i%`JQ?t$O(B, $BBg0hJQ(B
667: $B?tG[Ns$KEPO?$5$l$k(B. $B4X?tDj5AFb$G8=$l$?%W%m%0%i%`JQ?t$O(B, $B4X?tDj5A8GM-$N6I(B
668: $B=jJQ?tG[Ns$KEPO?$5$l(B, @code{USRF} $B9=B$BN$N%a%s%P(B @code{pvs}$B$H$7$FEPO?$5(B
669: $B$l$k(B. $B4X?t$,<B9T$5$l$k>l9g$K(B, $BEPO?$5$l$?6I=jJQ?tG[Ns$r%F%s%W%l!<%H$H$7$F(B,
670: $B%9%?%C%/$KAjEv$9$kJQ?tG[Ns$,@8@.$5$l(B, $B<B9T;~$NJQ?t$NCM$O$3$NG[Ns$K3JG<(B
671: $B$5$l$k(B.
672:
673: $BCf4V8@8l$K$*$$$F(B, $B%W%m%0%i%`JQ?t;2>H$O%$%s%G%C%/%9$K$h$j9T$o$l$k(B. $B4X?t(B
674: $BFb$G$NJQ?t;2>H$O(B, $BDL>o$O6I=jJQ?tG[NsFb$NJQ?t$KBP$9$k%$%s%G%C%/%9$,MQ$$$i(B
675: $B$l$k$,(B, extern $B@k8@$5$l$F$$$kJQ?t$K4X$7$F$O(B, $BF1L>$NBg0hJQ?tG[Ns$NJQ?t$K(B
676: $BBP$9$k%$%s%G%C%/%9$,MQ$$$i$l$k(B. $B$3$N>l9g(B, $B<B:]$K$O$3$N6hJL$O%$%s%G%C%/%9(B
677: $B$N:G>e0L%S%C%H$r(B 1 $B$K$9$k$3$H$G9T$C$F$$$k(B.
1.2 noro 678: \E
1.1 noro 679:
1.2 noro 680: \BEG
681: \E
1.1 noro 682:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>