version 1.3, 1999/12/21 02:47:31 |
version 1.5, 2000/09/23 07:53:24 |
|
|
@comment $OpenXM$ |
@comment $OpenXM: OpenXM/src/asir-doc/parts/asir.texi,v 1.4 2000/01/26 01:37:32 noro Exp $ |
\BJP |
\BJP |
@node $B%f!<%68@8l(B Asir,,, Top |
@node $B%f!<%68@8l(B Asir,,, Top |
@chapter $B%f!<%68@8l(B Asir |
@chapter $B%f!<%68@8l(B Asir |
Line 67 capital alphabetical letter in @b{Asir}. |
|
Line 67 capital alphabetical letter in @b{Asir}. |
|
@item |
@item |
\JP $BJQ?t$N7?$,$J$$(B. |
\JP $BJQ?t$N7?$,$J$$(B. |
\EG No types for variables. |
\EG No types for variables. |
|
@* |
\BJP |
\BJP |
$B4{$K@bL@$7$?$H$*$j(B, @b{Asir} $B$G07$o$l$kBP>]<+?H$OA4$F2?$i$+$N7?(B |
$B4{$K@bL@$7$?$H$*$j(B, @b{Asir} $B$G07$o$l$kBP>]<+?H$OA4$F2?$i$+$N7?(B |
$B$r;}$C$F$$$k(B. $B$7$+$7(B, $B%W%m%0%i%`JQ?t<+BN$O(B, $B$I$N$h$&$JBP>]$G$b(B |
$B$r;}$C$F$$$k(B. $B$7$+$7(B, $B%W%m%0%i%`JQ?t<+BN$O(B, $B$I$N$h$&$JBP>]$G$b(B |
Line 93 object can be assigned to it. |
|
Line 93 object can be assigned to it. |
|
@item |
@item |
\BJP |
\BJP |
$BH!?tFb$NJQ?t$O(B, $B%G%U%)%k%H$G$O2>0z?t$r$3$a$F$9$Y$F6I=jJQ?t(B. |
$BH!?tFb$NJQ?t$O(B, $B%G%U%)%k%H$G$O2>0z?t$r$3$a$F$9$Y$F6I=jJQ?t(B. |
|
@* |
$B$?$@$7(B, @code{extern} $B@k8@$5$l$?JQ?t$O(B, $B%H%C%W%l%Y%k$K$*$1$kBg0hJQ?t$H$J$k(B. |
$B$?$@$7(B, @code{extern} $B@k8@$5$l$?JQ?t$O(B, $B%H%C%W%l%Y%k$K$*$1$kBg0hJQ?t$H$J$k(B. |
$B$9$J$o$A(B, $BJQ?t$N%9%3!<%W$OBg0hJQ?t$H6I=jJQ?t$N(B 2 $B<oN`$KC1=c2=$5$l$F$$$k(B. |
$B$9$J$o$A(B, $BJQ?t$N%9%3!<%W$OBg0hJQ?t$H6I=jJQ?t$N(B 2 $B<oN`$KC1=c2=$5$l$F$$$k(B. |
$B%H%C%W%l%Y%k(B, $B$9$J$o$A%W%m%s%W%H$KBP$7$FF~NO$5$l$?JQ?t$OA4$FBg0hJQ?t(B |
$B%H%C%W%l%Y%k(B, $B$9$J$o$A%W%m%s%W%H$KBP$7$FF~NO$5$l$?JQ?t$OA4$FBg0hJQ?t(B |
Line 102 object can be assigned to it. |
|
Line 102 object can be assigned to it. |
|
\BEG |
\BEG |
Variables, together with formal parameters, in a function (procedure) |
Variables, together with formal parameters, in a function (procedure) |
are all local to the function by default. |
are all local to the function by default. |
|
@* |
Variables can be global at the top level, |
Variables can be global at the top level, |
if they are declared with the key word @code{extern}. |
if they are declared with the key word @code{extern}. |
Thus, the scope rule of @b{Asir} is very simple. |
Thus, the scope rule of @b{Asir} is very simple. |
|
|
@item |
@item |
\JP $B%W%m%0%i%`JQ?t$OBgJ8;z$G;O$^$j(B, $BITDj85(B, $BH!?t$O>.J8;z$G;O$^$k(B. |
\JP $B%W%m%0%i%`JQ?t$OBgJ8;z$G;O$^$j(B, $BITDj85(B, $BH!?t$O>.J8;z$G;O$^$k(B. |
\EG Program variables and algebraic indeterminates are distinguished in @b{Asir}. |
\EG Program variables and algebraic indeterminates are distinguished in @b{Asir}. |
|
@* |
\BJP |
\BJP |
$B$3$NE@$O(B, $B4{B8$N?t<0=hM}%7%9%F%`$N$[$H$s$I$H0[$J$kE@$G$"$k(B. @b{Asir} |
$B$3$NE@$O(B, $B4{B8$N?t<0=hM}%7%9%F%`$N$[$H$s$I$H0[$J$kE@$G$"$k(B. @b{Asir} |
$B$,$3$N;EMM$r:NMQ$7$?$N$O(B, $B%f!<%6$,ITDj85$N$D$b$j$G;HMQ$7$?JQ?t$K(B |
$B$,$3$N;EMM$r:NMQ$7$?$N$O(B, $B%f!<%6$,ITDj85$N$D$b$j$G;HMQ$7$?JQ?t$K(B |
Line 182 variables and indeterminates in a program. |
|
Line 182 variables and indeterminates in a program. |
|
@item |
@item |
\JP @code{switch} $BJ8(B, @code{goto} $B$,$J$$(B. |
\JP @code{switch} $BJ8(B, @code{goto} $B$,$J$$(B. |
\EG No @code{switch} statements, and @code{goto} statements. |
\EG No @code{switch} statements, and @code{goto} statements. |
|
@* |
\JP @code{goto} $B$,$J$$$?$a(B, $BB?=E%k!<%W$r0lEY$KH4$1$k$N$,$d$dJ#;($K$J$k>l9g$,$"$k(B. |
\JP @code{goto} $B$,$J$$$?$a(B, $BB?=E%k!<%W$r0lEY$KH4$1$k$N$,$d$dJ#;($K$J$k>l9g$,$"$k(B. |
\EG Lack of @code{goto} statement makes it rather bothering to exit from within multiple loops. |
\EG Lack of @code{goto} statement makes it rather bothering to exit from within multiple loops. |
|
|
Line 195 variables and indeterminates in a program. |
|
Line 195 variables and indeterminates in a program. |
|
Comma expressions are allowed only in @code{A}, @code{B} and @code{C} |
Comma expressions are allowed only in @code{A}, @code{B} and @code{C} |
of the constructs @code{for (A;B;C)} or @code{while(A)}. |
of the constructs @code{for (A;B;C)} or @code{while(A)}. |
\E |
\E |
|
@* |
\JP $B$3$l$O(B, $B%j%9%H$r@5<0$J%*%V%8%'%/%H$H$7$F2C$($?$3$H$K$h$k(B. |
\JP $B$3$l$O(B, $B%j%9%H$r@5<0$J%*%V%8%'%/%H$H$7$F2C$($?$3$H$K$h$k(B. |
\EG This limitation came from adopting lists as legal data objects for @b{Asir}. |
\EG This limitation came from adopting lists as legal data objects for @b{Asir}. |
|
|
Line 254 comprehensible than use of structure like C programs. |
|
Line 254 comprehensible than use of structure like C programs. |
|
* return $BJ8(B:: |
* return $BJ8(B:: |
* if $BJ8(B:: |
* if $BJ8(B:: |
* $B%k!<%W(B break return continue:: |
* $B%k!<%W(B break return continue:: |
|
* $B9=B$BNDj5A(B:: |
* $B$5$^$6$^$J<0(B:: |
* $B$5$^$6$^$J<0(B:: |
* $B%W%j%W%m%;%C%5(B:: |
* $B%W%j%W%m%;%C%5(B:: |
* $B%*%W%7%g%s;XDj(B:: |
* $B%*%W%7%g%s;XDj(B:: |
Line 267 comprehensible than use of structure like C programs. |
|
Line 268 comprehensible than use of structure like C programs. |
|
* return statement:: |
* return statement:: |
* if statement:: |
* if statement:: |
* loop break return continue:: |
* loop break return continue:: |
|
* structure definition:: |
* various expressions:: |
* various expressions:: |
* preprocessor:: |
* preprocessor:: |
* option:: |
* option:: |
Line 858 the @code{while} statement, the @code{for} statement, |
|
Line 860 the @code{while} statement, the @code{for} statement, |
|
@item |
@item |
\JP @code{while} $BJ8(B |
\JP @code{while} $BJ8(B |
\EG @code{while} statement |
\EG @code{while} statement |
|
@* |
\JP $B7A<0$O(B, |
\JP $B7A<0$O(B, |
\EG It has the following form. |
\EG It has the following form. |
|
|
|
|
@item |
@item |
\JP @code{for} $BJ8(B |
\JP @code{for} $BJ8(B |
\EG @code{for} statement |
\EG @code{for} statement |
|
@* |
\JP $B7A<0$O(B, |
\JP $B7A<0$O(B, |
\EG It has the following form. |
\EG It has the following form. |
|
|
Line 916 while ( expression ) @{ |
|
Line 918 while ( expression ) @{ |
|
@item |
@item |
\JP @code{do} $BJ8(B |
\JP @code{do} $BJ8(B |
\EG @code{do} statement |
\EG @code{do} statement |
|
@* |
@example |
@example |
\BJP |
\BJP |
do @{ |
do @{ |
Line 957 the control to a certain point of the loop. |
|
Line 959 the control to a certain point of the loop. |
|
|
|
@item |
@item |
@code{break} |
@code{break} |
|
@* |
\JP @code{break} $BJ8$O(B, $B$=$l$r0O$`%k!<%W$r0l$D$@$1H4$1$k(B. |
\JP @code{break} $BJ8$O(B, $B$=$l$r0O$`%k!<%W$r0l$D$@$1H4$1$k(B. |
\EG The @code{break} statement is used to exit the inner most loop. |
\EG The @code{break} statement is used to exit the inner most loop. |
@item |
@item |
@code{return} |
@code{return} |
|
@* |
\BJP |
\BJP |
@code{return} $BJ8$O(B, $B0lHL$KH!?t$+$iH4$1$k$?$a$NJ8$G$"$j(B, |
@code{return} $BJ8$O(B, $B0lHL$KH!?t$+$iH4$1$k$?$a$NJ8$G$"$j(B, |
$B%k!<%W$NCf$+$i$G$bM-8z$G$"$k(B. |
$B%k!<%W$NCf$+$i$G$bM-8z$G$"$k(B. |
Line 974 and it is also effective in a loop. |
|
Line 976 and it is also effective in a loop. |
|
|
|
@item |
@item |
@code{continue} |
@code{continue} |
|
@* |
\BJP |
\BJP |
@code{continue} $BJ8$O(B, $B%k!<%W$NK\BN$NJ8$NKvC<$K@)8f$r0\$9(B. |
@code{continue} $BJ8$O(B, $B%k!<%W$NK\BN$NJ8$NKvC<$K@)8f$r0\$9(B. |
$BNc$($P(B @code{for} $BJ8$G$O(B, $B:G8e$N<0JB$S$N<B9T$r9T$$(B, @code{while} |
$BNc$($P(B @code{for} $BJ8$G$O(B, $B:G8e$N<0JB$S$N<B9T$r9T$$(B, @code{while} |
Line 990 statement, and the termination condition will be evalu |
|
Line 992 statement, and the termination condition will be evalu |
|
@end itemize |
@end itemize |
|
|
\BJP |
\BJP |
|
@node $B9=B$BNDj5A(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B |
|
@subsection $B9=B$BNDj5A(B |
|
\E |
|
\BEG |
|
@node structure definition,,, Writing user defined functions |
|
@subsection structure definition |
|
\E |
|
|
|
\BJP |
|
$B9=B$BN$H$O(B, $B3F@.J,$NMWAG$,L>A0$G%"%/%;%9$G$-$k8GDjD9G[Ns$H;W$C$F$h$$(B. |
|
$B3F9=B$BN$OL>A0$G6hJL$5$l$k(B. $B9=B$BN$O(B, @code{struct} $BJ8$K$h$j@k8@$5$l$k(B. |
|
$B$"$k7?$N9=B$BN$O(B, $BAH$_9~$_4X?t(B @code{newstruct} $B$K$h$j@8@.$5$l$k(B. |
|
$B9=B$BN$N3F%a%s%P$O(B, $B1i;;;R(B @code{->} $B$K$h$j%"%/%;%9$9$k(B. |
|
$B%a%s%P$,9=B$BN$N>l9g(B, @code{->} $B$K$h$k;XDj$OF~$l;R$K$G$-$k(B. |
|
\E |
|
|
|
\BEG |
|
A structure data type is a fixed length array and each component of the array |
|
is accessed by its name. Each type of structure is distinguished by its name. |
|
A structure data type is declared by @code{struct} statement. |
|
A structure object is generated by a builtin function @code{newstruct}. |
|
Each member of a structure is accessed by an operatator @code{->}. |
|
If a member of a structure is again a structure, then the specification |
|
by @code{->} can be nested. |
|
\E |
|
|
|
@example |
|
[1] struct rat @{num,denom@}; |
|
0 |
|
[2] A = newstruct(rat); |
|
@{0,0@} |
|
[3] A->num = 1; |
|
1 |
|
[4] A->den = 2; |
|
2 |
|
[5] A; |
|
@{1,2@} |
|
@end example |
|
|
|
\BJP |
@node $B$5$^$6$^$J<0(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B |
@node $B$5$^$6$^$J<0(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B |
@subsection $B$5$^$6$^$J<0(B |
@subsection $B$5$^$6$^$J<0(B |
\E |
\E |
Line 1006 statement, and the termination condition will be evalu |
|
Line 1048 statement, and the termination condition will be evalu |
|
@item |
@item |
\JP $B2C8:>h=|(B, $BQQ(B |
\JP $B2C8:>h=|(B, $BQQ(B |
\EG addition, subtraction, multiplication, division, exponentiation |
\EG addition, subtraction, multiplication, division, exponentiation |
|
@* |
\BJP |
\BJP |
$BQQ$O(B, @samp{^} $B$K$h$jI=$9(B. $B=|;;(B @samp{/} $B$O(B, $BBN$H$7$F$N1i;;$KMQ$$$k(B. |
$BQQ$O(B, @samp{^} $B$K$h$jI=$9(B. $B=|;;(B @samp{/} $B$O(B, $BBN$H$7$F$N1i;;$KMQ$$$k(B. |
$BNc$($P(B, @code{2/3} $B$OM-M}?t$N(B @code{2/3} $B$rI=$9(B. |
$BNc$($P(B, @code{2/3} $B$OM-M}?t$N(B @code{2/3} $B$rI=$9(B. |
Line 1027 x+1 A^2*B*afo X/3 |
|
Line 1069 x+1 A^2*B*afo X/3 |
|
@item |
@item |
\JP $B%$%s%G%C%/%9$D$-$NJQ?t(B |
\JP $B%$%s%G%C%/%9$D$-$NJQ?t(B |
\EG programming variables with indices |
\EG programming variables with indices |
|
@* |
\BJP |
\BJP |
$B%Y%/%H%k(B, $B9TNs(B, $B%j%9%H$NMWAG$O%$%s%G%C%/%9$rMQ$$$k$3$H$K$h$j<h$j=P$;$k(B. |
$B%Y%/%H%k(B, $B9TNs(B, $B%j%9%H$NMWAG$O%$%s%G%C%/%9$rMQ$$$k$3$H$K$h$j<h$j=P$;$k(B. |
$B%$%s%G%C%/%9$O(B 0 $B$+$i;O$^$k$3$H$KCm0U$9$k(B. $B<h$j=P$7$?MWAG$,%Y%/%H%k(B, |
$B%$%s%G%C%/%9$O(B 0 $B$+$i;O$^$k$3$H$KCm0U$9$k(B. $B<h$j=P$7$?MWAG$,%Y%/%H%k(B, |
|
|
@item |
@item |
\JP $BHf3S1i;;(B |
\JP $BHf3S1i;;(B |
\EG comparison operation |
\EG comparison operation |
|
@* |
\BJP |
\BJP |
$BEy$7$$(B (@samp{==}), $BEy$7$/$J$$(B (@samp{!=}), $BBg>.(B (@samp{>}, @samp{<}, |
$BEy$7$$(B (@samp{==}), $BEy$7$/$J$$(B (@samp{!=}), $BBg>.(B (@samp{>}, @samp{<}, |
@samp{>=}, @samp{<=}) $B$N(B 2 $B9`1i;;$,$"$k(B. $B??$J$i$PM-M}?t$N(B 1, $B56$J$i$P(B |
@samp{>=}, @samp{<=}) $B$N(B 2 $B9`1i;;$,$"$k(B. $B??$J$i$PM-M}?t$N(B 1, $B56$J$i$P(B |
Line 1065 or 0 for the false. |
|
Line 1107 or 0 for the false. |
|
@item |
@item |
\JP $BO@M}<0(B |
\JP $BO@M}<0(B |
\EG logical expression |
\EG logical expression |
|
@* |
\BJP |
\BJP |
$BO@M}@Q(B (@samp{&&}), $BO@M}OB(B (@samp{||}) $B$N(B 2 $B9`1i;;$H(B, $BH]Dj(B (@samp{!}) |
$BO@M}@Q(B (@samp{&&}), $BO@M}OB(B (@samp{||}) $B$N(B 2 $B9`1i;;$H(B, $BH]Dj(B (@samp{!}) |
$B$,MQ0U$5$l$F$$$k(B. $BCM$O$d$O$j(B 1, 0 $B$G$"$k(B. |
$B$,MQ0U$5$l$F$$$k(B. $BCM$O$d$O$j(B 1, 0 $B$G$"$k(B. |
Line 1082 and 0 for the false. |
|
Line 1124 and 0 for the false. |
|
@item |
@item |
\JP $BBeF~(B |
\JP $BBeF~(B |
\EG assignment |
\EG assignment |
|
@* |
\BJP |
\BJP |
$BDL>o$NBeF~$O(B @samp{=} $B$G9T$&(B. $B$3$N$[$+(B, $B;;=Q1i;;;R$HAH$_9g$o$;$F(B |
$BDL>o$NBeF~$O(B @samp{=} $B$G9T$&(B. $B$3$N$[$+(B, $B;;=Q1i;;;R$HAH$_9g$o$;$F(B |
$BFC<l$JBeF~$r9T$&$3$H$b$G$-$k(B. |
$BFC<l$JBeF~$r9T$&$3$H$b$G$-$k(B. |
Line 1100 There are special assignments combined with arithmetic |
|
Line 1142 There are special assignments combined with arithmetic |
|
@item |
@item |
\JP $BH!?t8F$S=P$7(B |
\JP $BH!?t8F$S=P$7(B |
\EG function call |
\EG function call |
|
@* |
\JP $BH!?t8F$S=P$7$b<0$N0l<o$G$"$k(B. |
\JP $BH!?t8F$S=P$7$b<0$N0l<o$G$"$k(B. |
\EG A function call is also an expression. |
\EG A function call is also an expression. |
@item |
@item |
@samp{++}, @samp{--} |
@samp{++}, @samp{--} |
|
@* |
\JP $B$3$l$i$O(B, $BJQ?t$NA08e$K$D$$$F(B, $B$=$l$>$l<!$N$h$&$JA`:n(B, $BCM$rI=$9(B. |
\JP $B$3$l$i$O(B, $BJQ?t$NA08e$K$D$$$F(B, $B$=$l$>$l<!$N$h$&$JA`:n(B, $BCM$rI=$9(B. |
\BEG |
\BEG |
These operators are attached to or before a program variable, |
These operators are attached to or before a program variable, |
Line 1156 through @code{cpp}. This enables @b{Asir} user to use |
|
Line 1198 through @code{cpp}. This enables @b{Asir} user to use |
|
@itemize @bullet |
@itemize @bullet |
@item |
@item |
@code{#include} |
@code{#include} |
|
@* |
\BJP |
\BJP |
@code{cpp} $B$KFC$K0z?t$rEO$5$J$$$?$a(B, $B%$%s%/%k!<%I%U%!%$%k$O(B, |
@code{cpp} $B$KFC$K0z?t$rEO$5$J$$$?$a(B, $B%$%s%/%k!<%I%U%!%$%k$O(B, |
@code{#include} $B$,=q$+$l$F$$$k%U%!%$%k$HF1$8%G%#%l%/%H%j$G%5!<%A$5$l$k(B. |
@code{#include} $B$,=q$+$l$F$$$k%U%!%$%k$HF1$8%G%#%l%/%H%j$G%5!<%A$5$l$k(B. |
Line 1168 containing @code{#include} so that no arguments are pa |
|
Line 1210 containing @code{#include} so that no arguments are pa |
|
|
|
@item |
@item |
@code{#define} |
@code{#define} |
|
@* |
\JP $B$3$l$O(B, C $B$K$*$1$k$N$HA4$/F1MM$KMQ$$$k$3$H$,$G$-$k(B. |
\JP $B$3$l$O(B, C $B$K$*$1$k$N$HA4$/F1MM$KMQ$$$k$3$H$,$G$-$k(B. |
\EG This can be used just as in C language. |
\EG This can be used just as in C language. |
|
|
@item |
@item |
@code{#if} |
@code{#if} |
|
@* |
\BJP |
\BJP |
@code{/*}, @code{*/} $B$K$h$k%3%a%s%H$OF~$l;R$K$G$-$J$$$N$G(B, $B%W%m%0%i%`(B |
@code{/*}, @code{*/} $B$K$h$k%3%a%s%H$OF~$l;R$K$G$-$J$$$N$G(B, $B%W%m%0%i%`(B |
$B$NBg$-$JItJ,$r%3%a%s%H%"%&%H$9$k:]$K(B, @code{#if 0}, @code{#endif} |
$B$NBg$-$JItJ,$r%3%a%s%H%"%&%H$9$k:]$K(B, @code{#if 0}, @code{#endif} |