mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-17 06:58:05 +11:00
Optimize parsing words
This commit is contained in:
parent
931c812394
commit
8009270e79
4
blk/446
4
blk/446
@ -3,8 +3,8 @@
|
||||
|
||||
: (parsec) ( a -- n f )
|
||||
( apostrophe is ASCII 39 )
|
||||
DUP C@ 39 = NOT IF 0 EXIT THEN ( a 0 )
|
||||
DUP 2+ C@ 39 = NOT IF 0 EXIT THEN ( a 0 )
|
||||
DUP C@ 39 = OVER 2+ C@ 39 = AND ( a f )
|
||||
NOT IF 0 EXIT THEN ( a 0 )
|
||||
( surrounded by apos, good, return )
|
||||
1+ C@ 1 ( n 1 )
|
||||
;
|
||||
|
3
blk/447
3
blk/447
@ -2,8 +2,7 @@
|
||||
: _ ( c -- n )
|
||||
( '0' is ASCII 48 )
|
||||
48 -
|
||||
DUP 0< IF EXIT THEN ( bad )
|
||||
DUP 10 < IF EXIT THEN ( good )
|
||||
DUP 0< ( bad ) OVER 10 < ( good ) OR IF EXIT THEN
|
||||
( 'a' is ASCII 97. 59 = 97 - 48 )
|
||||
49 -
|
||||
DUP 0< IF EXIT THEN ( bad )
|
||||
|
3
blk/449
3
blk/449
@ -2,8 +2,7 @@
|
||||
: _ ( c -- n )
|
||||
( '0' is ASCII 48 )
|
||||
48 -
|
||||
DUP 0< IF EXIT THEN ( bad )
|
||||
DUP 2 < IF EXIT THEN ( good )
|
||||
DUP 0< ( bad ) OVER 2 < ( good ) OR IF EXIT THEN
|
||||
( bad )
|
||||
255 -
|
||||
;
|
||||
|
BIN
emul/forth.bin
BIN
emul/forth.bin
Binary file not shown.
Loading…
Reference in New Issue
Block a user