Add compile,

This commit is contained in:
Koichi Nakamura 2021-01-16 09:12:08 +09:00
parent 44b3376dab
commit 9ce6585e10
2 changed files with 11 additions and 8 deletions

View file

@ -543,6 +543,9 @@ allot-cell : &find! [ ' L , , ] ; \ ( c-addr -- nt ) Throw exception at error
' (compile)
; immediate
\ runtime: ( w -- )
: compile, , ;
\ ( -- xt )
: :noname
align
@ -2582,7 +2585,7 @@ need-defined (read)
catch throw success
: ; [ ] immediate create >body :noname does>
variable constant value to
' ['] compile [compile] literal state
' ['] compile compile, [compile] literal state
+ - * /mod / mod negate not and or xor invert within max min abs
< > <= >= = <> 0< 0> 0<= 0>= 0= 0<> 1+ 1-
u< u> u<= u>= lshift rshift 2* 2/

View file

@ -433,17 +433,17 @@ T{ 25 RN2 execute -> 33 22 11 0 }T
\ -----------------------------------------------------------------------------
testing C"
T{ : CQ1 C" 123" ; -> }T
T{ CQ1 COUNT EVALUATE -> 123 }T
T{ : CQ2 C" " ; -> }T
T{ CQ2 COUNT EVALUATE -> }T
T{ : CQ3 C" 2345"COUNT EVALUATE ; CQ3 -> 2345 }T
skip T{ : CQ1 C" 123" ; -> }T
skip T{ CQ1 COUNT EVALUATE -> 123 }T
skip T{ : CQ2 C" " ; -> }T
skip T{ CQ2 COUNT EVALUATE -> }T
skip T{ : CQ3 C" 2345"COUNT EVALUATE ; CQ3 -> 2345 }T
\ -----------------------------------------------------------------------------
testing COMPILE,
testing compile,
:noname dup + ; constant dup+
T{ : Q dup+ COMPILE, ; -> }T
T{ : Q dup+ compile, ; -> }T
T{ : AS1 [ Q ] ; -> }T
T{ 123 AS1 -> 246 }T