Article View: fj.lang.forth
Article #20Re: Internal interpreter (Re: Introduction to FORTH)
From: Yuuichi YASUDA
Date: Fri, 11 Sep 1992 04:34
Date: Fri, 11 Sep 1992 04:34
79 lines
2473 bytes
2473 bytes
$@J]ED!w#P#F#U$G$9!#(J
Masami Takikawa (logic@mtak.bsj.com) wrote:
: $@KM$N(J 386 forth $@$O!"$3$l0J>eC;$$%$%s%?!<%W%j%?$O$J$$$@$m!*$H$$(J
: $@$&$b$N$G$9!JH?O@4?7^(J :-$@!K!#(J
:
: lodsd
: jmp eax
$@$0$&$N2;$b=P$^$;$s!#(J
: $@$3$l$@$1$G$9!#C;$$$N$G!"FHN)$7$?%$%s%?!<%W%j%?$K$;$:$K!"$9$Y$F(J
: $@$N%o!<%I$N:G8e$K>e$N#29T$r=q$-$^$9!#Nc$($P!"(J+ $@$O!"0J2<$N$h$&$K(J
: $@$J$j$^$9!#(J
: dd $@<!$N%o!<%I$N%"%I%l%9(J
: db 1 ; $@L>A0$ND9$5(J
: db '+' ; $@L>A0(J
: pop eax ; $@%9%?%C%/$+$iCM$r<h$C$F$/$k(J
: add ecx, eax ; TOS $@$KB-$9(J
: lodsd ; $@%$%s%?%W%j%?$rD>@\=q$$$A$c$&!*(J
: jmp eax
:
: TOS $@$b%l%8%9%?$KF~$C$F$$$^$9$N$G!"9bB.$G$9!#(J
$@%+%C%3$$$$%$%s%W%j%a%s%H$G$9$M!*(J
Forth $@$G$O%W%j%_%F%#%V$J8l$KBP1~$9$k5!3#8l$O6KC;$$$N$G!"%$%s%?%W(J
$@%j%?$N%*!<%P%X%C%I$r>.$5$/$9$k$3$H$O=EMW$G$9!#(J
$@$3$3$^$G$d$C$F$7$^$&$H!"$"$H$O(JForth $@8l(J(word)$@$N%3%s%Q%$%k;~$K(JCPU
$@%M%$%F%#%V$J%3!<%I$KE83+$9$k0L$7$+9bB.2=$N<jK!$O$J$$$H;W$$$^$9!#(J
$@$A$J$_$K(JGCC 2.* $@$KDI2C$5$l$?3HD%9=J8$r;H$C$FF1Ey$N%$%s%?%W%j%?$r(J
$@:n$k$H!"$*$^$1$N$h$&$J$b$N$K$J$j$^$9!#(J
$@!J3t!K#P#F#U!!#43+!K#2!]#3%=%U%H2]!!!!!!!!!!J]ED!!M-0l(J
Internet: gojira@pfu.fujitsu.co.jp Nifty-SERVE: NAF00775
$@!]$*$^$1!](J
$@Cm!'<-=q$N9=B$$O=|$-$^$7$?!#(J
typedef union cell {
void *p;
int i;
unsigned u;
union cell *c;
} CELL;
#define NEXT goto *(w = (*ip++).p);
kernel() {
register CELL *ip, *sp, *rp, *w, tos, work;
/* ip: instruction pointer */
/* sp: parameter stack pointer */
/* rp: return stack pointer */
/* tos: top of stack chache register */
.....
op_docol: /* DOCOL */
(*--rp).c = ip;
ip = w++;
NEXT;
op_semis: /* S; */
ip = (*--rp).p;
NEXT;
op_minus: /* - */
tos.i = -tos.i;
op_plus: /* + */
tos.i += (*sp++).i;
NEXT;
op_swap: /* SWAP */
work = (*sp);
(*sp) = tos;
tos = work;
NEXT;
op_drop: /* DROP */
tos = *sp++;
NEXT;
.....
}
Technical Details
Message-ID:
<5839@pfrad.pfu.fujitsu.co.jp>Path:
arc1-ca.pugleaf.net!sparky!uunet!ccut!sh.wide!fgw!fdm!pfrad!amaebi!gojiraReferences:
<GHPeg.933@mtak.bsj.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ccut!sh.wide!fgw!fdm!pfrad!amaebi!gojira From: gojira@pfu.fujitsu.co.jp (Yuuichi YASUDA) Newsgroups: fj.lang.forth Subject: Re: Internal interpreter (Re: Introduction to FORTH) Message-ID: <5839@pfrad.pfu.fujitsu.co.jp> Date: 11 Sep 92 04:34:21 GMT References: <GHPeg.933@mtak.bsj.com> Sender: news@pfrad.pfu.fujitsu.co.jp Distribution: fj Lines: 79 X-Newsreader: Tin 1.1 PL5