commit 7ac00bf7206105dfada68b922a66a9bb429a9db1 parent 0d4ead395e15799dffcf96515652701fd56020d6 Author: Henry Wilson <m3henry@googlemail.com> Date: Fri, 4 Aug 2017 18:10:05 +0100 Added ['] CONSTANT VARIABLE & FORGET Diffstat:
M | compiler.s | | | 51 | ++++++++++++++++++++++++++++++++++++++++++++++++++- |
1 file changed, 50 insertions(+), 1 deletion(-)
diff --git a/compiler.s b/compiler.s @@ -64,7 +64,7 @@ verb forth markstore ">@MARK" immediate # ( quad -- addr ) compile endword -# +# Word Compiling verb forth compnew "\x3A" #":" do modeC @@ -93,6 +93,38 @@ verb forth IMMEDIATE do store endword +verb forth brackettick "[\x27]" immediate #"'" + const ' ' + do WORD + do FIND + if 1f + do ABORT +1: compile docon + compile + endword + +verb forth FORGET + const ' ' + do WORD + get LAST +2: do dup2 + const 8 + do plus + do STRCMP + unless 1f + do DUP + set here + do fetch + set LAST + do DROP + endword +1: do fetch + do DUP + if 2b + do ABORT + + endword + # Indefinite Loops verb forth BEGIN "BEGIN" immediate @@ -253,3 +285,20 @@ verb forth echo ".\"" immediate do ALLOT compile PRINT endword + +# Compile Literals + +verb forth CONSTANT + do compnew + do SWAP + compile docon + compile + do compend + endword + +verb forth VARIABLE + do compnew + compile dovar + compile 0 + do compend + endword