From: Tim Vaughan Date: Mon, 18 Apr 2016 19:32:39 +0000 (+1200) Subject: Added HIDE, IMMEDIATE X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=ce55be3d16cf4ccb4284d323fc045b2afed20320;p=forth.jl.git Added HIDE, IMMEDIATE --- diff --git a/src/forth.jl b/src/forth.jl index cdfe88d..8c5c3de 100644 --- a/src/forth.jl +++ b/src/forth.jl @@ -700,6 +700,12 @@ HIDDEN = defPrim("HIDDEN", () -> begin reurn mem[NEXT] end) +HIDE = defWord("HIDE", + [WORD, + FIND, + HIDDEN, + EXIT]) + COLON = defWord(":", [WORD, CREATE, @@ -714,6 +720,12 @@ SEMICOLON = defWord(";", LBRAC, EXIT], flags=F_IMMEDIATE) +IMMEDIATE = defPrim("IMMEDIATE", () -> begin + lenAndFlagsAddr = mem[LATEST] + 1 + mem[lenAndFlagsAddr] = mem[lenAndFlagsAddr] $ F_IMMEDIATE + return mem[NEXT] +end, flags=F_IMMEDIATE) + #### VM loop #### function runVM() jmp = NEXT