From: Tim Vaughan Date: Tue, 26 Apr 2016 09:33:11 +0000 (+1200) Subject: Added LOOP+ and expressed LOOP as a special case. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=1a8bb251eb6ed601ccfcfdc4fd3b7b48bea97abd;p=forth.jl.git Added LOOP+ and expressed LOOP as a special case. --- diff --git a/src/lib.4th b/src/lib.4th index c9e07bf..f4e9908 100644 --- a/src/lib.4th +++ b/src/lib.4th @@ -112,14 +112,19 @@ : I RSP@ 2- @ ; -: LOOP IMMEDIATE - ' R> , ' R> , ' 1+ , ' 2DUP , ' - , +: LOOP+ IMMEDIATE + ' R> , ' R> , ' -ROT , ' + , ' 2DUP , ' - , ' SWAP , ' >R , ' SWAP , ' >R , ' 0<= , ' 0BRANCH , HERE @ - , ' RDROP , ' RDROP , ; +: LOOP IMMEDIATE + ' LIT , 1 , + [COMPILE] LOOP+ +; + \ COMMENTS ----------------------------------------------------------------------