commit 9bbb7f7d3741b65224a79d409b389a25e666a307
parent 8ca16e4b4977a22104439cf409fd3384cdb5282f
Author: Henry Wilson <m3henry@googlemail.com>
Date: Tue, 19 Jun 2018 12:43:22 +0100
Added new word: LITERAL
Use when compiling to compile a constant from the stack
example:
: STAR [ 40 2 + ] LITERAL EMIT ;
Diffstat:
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/compiler.s b/compiler.s
@@ -299,11 +299,15 @@ verb forth echo ".\"" immediate
# Compile Literals
+verb forth LITERAL "LITERAL" immediate
+ compile docon
+ compile
+ endword
+
verb forth CONSTANT
do compnew
do SWAP
- compile docon
- compile
+ do LITERAL
do compend
endword
diff --git a/interpreter.s b/interpreter.s
@@ -33,9 +33,7 @@ verb forth INTERPRET
do ABORT
5: get MODE
unless 2f
- const docon
- do comma
- do comma
+ do LITERAL
goto 2f
1: do DUP
do fetch