32 lines
671 B
Plaintext
32 lines
671 B
Plaintext
|
2 const cell
|
||
|
: cells cell * ;
|
||
|
|
||
|
key ) const ')'
|
||
|
|
||
|
10 const '\n'
|
||
|
key const sp
|
||
|
|
||
|
: cr '\n' emit ;
|
||
|
: bl sp emit ;
|
||
|
|
||
|
: if ' BZ_ , here 0 , ; immediate
|
||
|
: else ' GOTO_ , 0 , here swap ! here cell - ; immediate
|
||
|
: then here swap ! ; immediate
|
||
|
|
||
|
: begin here ; immediate
|
||
|
: while ' BZ_ , here 0 , ; immediate
|
||
|
: repeat ' GOTO_ , swap , here swap ! ; immediate
|
||
|
|
||
|
: ( begin key ')' != while repeat ; immediate
|
||
|
|
||
|
: 2dup over over ;
|
||
|
|
||
|
: decompile
|
||
|
word lookup drop 1 begin ( cp i )
|
||
|
2dup cells + @ ( cp i @cp+i )
|
||
|
dup ' _RET != ( cp i @cp+i bool )
|
||
|
while
|
||
|
dup ` dup if .s drop else drop . then bl ( cp i )
|
||
|
1 + ( cp i+1 )
|
||
|
repeat drop drop drop ;
|