commit 85b6228809bb1895bb2b376ae4ad1495c43c3f44 parent 41a76cc0db57b42d21467cbe0e10dfed93d9aa96 Author: Henry Wilson <m3henry@googlemail.com> Date: Tue, 1 Aug 2017 13:59:56 +0100 BEGIN ... UNTIL & BEGIN ... WHILE ... REPEAT Diffstat:
M | compiler.s | | | 51 | ++++++++++++++++++++++++++++++++++++++++++++------- |
1 file changed, 44 insertions(+), 7 deletions(-)
diff --git a/compiler.s b/compiler.s @@ -25,25 +25,62 @@ verb forth COMPILE "COMPILE" immediate do ALLOT endword +.macro compile value +.ifnb \value + const \value +.endif + do COMPILE +.endm + verb forth compnew "\x3A" # : do modeC get HERE get LAST - do COMPILE + compile do WORD do fetch const 8 do plus do ALLOT - do TRUE - do COMPILE - const enter - do COMPILE + compile -1 + compile enter endword verb forth compend "\x3B" immediate # ; - const EXIT - do COMPILE + compile EXIT do modeI set LAST endword + +verb forth BEGIN "BEGIN" immediate + get HERE + endword + +verb forth AGAIN "AGAIN" immediate + compile dogoto + compile + endword + +verb forth UNTIL "UNTIL" immediate + compile iszero + compile dobranch + compile + endword + +verb forth WHILE "WHILE" immediate + compile iszero + compile dobranch + get HERE + do SWAP + compile + endword + +verb forth REPEAT "REPEAT" immediate + compile dogoto + do DUP + do fetch + compile + get HERE + do SWAP + do store + endword