mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-17 07:38: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 )
|
: (parsec) ( a -- n f )
|
||||||
( apostrophe is ASCII 39 )
|
( apostrophe is ASCII 39 )
|
||||||
DUP C@ 39 = NOT IF 0 EXIT THEN ( a 0 )
|
DUP C@ 39 = OVER 2+ C@ 39 = AND ( a f )
|
||||||
DUP 2+ C@ 39 = NOT IF 0 EXIT THEN ( a 0 )
|
NOT IF 0 EXIT THEN ( a 0 )
|
||||||
( surrounded by apos, good, return )
|
( surrounded by apos, good, return )
|
||||||
1+ C@ 1 ( n 1 )
|
1+ C@ 1 ( n 1 )
|
||||||
;
|
;
|
||||||
|
3
blk/447
3
blk/447
@ -2,8 +2,7 @@
|
|||||||
: _ ( c -- n )
|
: _ ( c -- n )
|
||||||
( '0' is ASCII 48 )
|
( '0' is ASCII 48 )
|
||||||
48 -
|
48 -
|
||||||
DUP 0< IF EXIT THEN ( bad )
|
DUP 0< ( bad ) OVER 10 < ( good ) OR IF EXIT THEN
|
||||||
DUP 10 < IF EXIT THEN ( good )
|
|
||||||
( 'a' is ASCII 97. 59 = 97 - 48 )
|
( 'a' is ASCII 97. 59 = 97 - 48 )
|
||||||
49 -
|
49 -
|
||||||
DUP 0< IF EXIT THEN ( bad )
|
DUP 0< IF EXIT THEN ( bad )
|
||||||
|
3
blk/449
3
blk/449
@ -2,8 +2,7 @@
|
|||||||
: _ ( c -- n )
|
: _ ( c -- n )
|
||||||
( '0' is ASCII 48 )
|
( '0' is ASCII 48 )
|
||||||
48 -
|
48 -
|
||||||
DUP 0< IF EXIT THEN ( bad )
|
DUP 0< ( bad ) OVER 2 < ( good ) OR IF EXIT THEN
|
||||||
DUP 2 < IF EXIT THEN ( good )
|
|
||||||
( bad )
|
( bad )
|
||||||
255 -
|
255 -
|
||||||
;
|
;
|
||||||
|
BIN
emul/forth.bin
BIN
emul/forth.bin
Binary file not shown.
Loading…
Reference in New Issue
Block a user