diff --git a/src/waforth.wat b/src/waforth.wat index 3ad3b4d..dd30b8d 100644 --- a/src/waforth.wat +++ b/src/waforth.wat @@ -64,8 +64,9 @@ ;; COMPILE_EXECUTE_INDEX := 5 ;; PUSH_INDIRECT_INDEX := 6 ;; RESET_MARKER_INDEX := 7 + ;; EXECUTE_DEFER_INDEX := 8 ;; END_DO_INDEX := 9 - (table (export "table") 0xb6 funcref) + (table (export "table") 0xbb funcref) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -243,7 +244,7 @@ (local $bbtos i32) (local $m i64) (local $npo i32) - (local.set $base (i64.extend_i32_u (i32.load (i32.const 0x203bc (; = body(BASE) ;))))) + (local.set $base (i64.extend_i32_u (i32.load (i32.const 0x203d0 (; = body(BASE) ;))))) (local.set $v (i64.load (local.tee $bbtos (i32.sub (local.get $tos) (i32.const 8))))) (local.set $m (i64.rem_u (local.get $v) (local.get $base))) (local.set $v (i64.div_u (local.get $v) (local.get $base))) @@ -270,7 +271,7 @@ (local $bbtos i32) (local $m i64) (local $po i32) - (local.set $base (i64.extend_i32_u (i32.load (i32.const 0x203bc (; = body(BASE) ;))))) + (local.set $base (i64.extend_i32_u (i32.load (i32.const 0x203d0 (; = body(BASE) ;))))) (local.set $v (i64.load (local.tee $bbtos (i32.sub (local.get $tos) (i32.const 8))))) (local.set $po (global.get $po)) (loop $loop @@ -402,7 +403,7 @@ (then (call $shell_emit (i32.const 0x2d)) (local.set $v (i32.sub (i32.const 0) (local.get $v))))) - (call $U._ (local.get $v) (i32.load (i32.const 0x203bc (; = body(BASE) ;)))) + (call $U._ (local.get $v) (i32.load (i32.const 0x203d0 (; = body(BASE) ;)))) (call $shell_emit (i32.const 0x20))) (data (i32.const 0x2016c) "\60\01\02\00" "\01" ". " "\21\00\00\00") (elem (i32.const 0x21) $.) @@ -412,7 +413,7 @@ (local.get $tos) (call $ensureCompiling) (call $Sq) - (call $compileCall (i32.const 0) (i32.const 0xa2 (; = index("TYPE") ;)))) + (call $compileCall (i32.const 0) (i32.const 0xa7 (; = index("TYPE") ;)))) (data (i32.const 0x20178) "\6c\01\02\00" "\82" (; F_IMMEDIATE ;) ".\22 " "\22\00\00\00") (elem (i32.const 0x22) $.q) @@ -423,7 +424,7 @@ (block $endLoop (loop $loop (br_if $endLoop (i32.ge_u (local.get $p) (local.get $tos))) - (call $U._ (i32.load (local.get $p)) (i32.load (i32.const 0x203bc (; = body(BASE) ;)))) + (call $U._ (i32.load (local.get $p)) (i32.load (i32.const 0x203d0 (; = body(BASE) ;)))) (call $shell_emit (i32.const 0x20)) (local.set $p (i32.add (local.get $p) (i32.const 4))) (br $loop))) @@ -801,7 +802,7 @@ (local.get $tos) (call $compileIf) (call $Sq) - (call $compileCall (i32.const 0) (i32.const 0xa2 (; = index("TYPE") ;))) + (call $compileCall (i32.const 0) (i32.const 0xa7 (; = index("TYPE") ;))) (call $compileCall (i32.const 0) (i32.const 0x43 (; = index("ABORT") ;))) (call $compileThen)) (data (i32.const 0x20344) "\34\03\02\00" "\86" (; F_IMMEDIATE ;) "ABORT\22 " "\44\00\00\00") @@ -845,12 +846,31 @@ (data (i32.const 0x20360) "\54\03\02\00" "\06" "ACCEPT " "\46\00\00\00") (elem (i32.const 0x46) $ACCEPT) + ;; [6.2.0698](https://forth-standard.org/standard/core/ACTION-OF) + (func $ACTION-OF (param $tos i32) (result i32) + (local $xtp i32) + (local $btos i32) + (local.set $xtp + (i32.add + (call $body (drop (call $find! (call $parseName)))) + (i32.const 4))) + (if (result i32) (i32.eqz (i32.load (i32.const 0x20900 (; = body(STATE) ;)))) + (then + (call $push (local.get $tos) (i32.load (local.get $xtp)))) + (else + (call $emitConst (local.get $xtp)) + (call $emitLoad) + (call $compilePush) + (local.get $tos)))) + (data (i32.const 0x20370) "\60\03\02\00" "\89" (; F_IMMEDIATE ;) "ACTION-OF " "\47\00\00\00") + (elem (i32.const 0x47) $ACTION-OF) + ;; [6.1.0705](https://forth-standard.org/standard/core/ALIGN) (func $ALIGN (param $tos i32) (result i32) (global.set $here (call $aligned (global.get $here))) (local.get $tos)) - (data (i32.const 0x20370) "\60\03\02\00" "\05" "ALIGN " "\47\00\00\00") - (elem (i32.const 0x47) $ALIGN) + (data (i32.const 0x20384) "\70\03\02\00" "\05" "ALIGN " "\48\00\00\00") + (elem (i32.const 0x48) $ALIGN) ;; [6.1.0706](https://forth-standard.org/standard/core/ALIGNED) (func $ALIGNED (param $tos i32) (result i32) @@ -858,8 +878,8 @@ (i32.store (local.tee $btos (i32.sub (local.get $tos) (i32.const 4))) (call $aligned (i32.load (local.get $btos)))) (local.get $tos)) - (data (i32.const 0x20380) "\70\03\02\00" "\07" "ALIGNED" "\48\00\00\00") - (elem (i32.const 0x48) $ALIGNED) + (data (i32.const 0x20394) "\84\03\02\00" "\07" "ALIGNED" "\49\00\00\00") + (elem (i32.const 0x49) $ALIGNED) ;; [6.1.0710](https://forth-standard.org/standard/core/ALLOT) (func $ALLOT (param $tos i32) (result i32) @@ -867,8 +887,8 @@ (local.get $tos) (local.set $v (call $pop)) (global.set $here (i32.add (global.get $here) (local.get $v)))) - (data (i32.const 0x20390) "\80\03\02\00" "\05" "ALLOT " "\49\00\00\00") - (elem (i32.const 0x49) $ALLOT) + (data (i32.const 0x203a4) "\94\03\02\00" "\05" "ALLOT " "\4a\00\00\00") + (elem (i32.const 0x4a) $ALLOT) ;; [6.1.0720](https://forth-standard.org/standard/core/AND) (func $AND (param $tos i32) (result i32) @@ -878,33 +898,33 @@ (i32.and (i32.load (local.tee $btos (i32.sub (local.get $tos) (i32.const 4)))) (i32.load (local.get $bbtos)))) (local.get $btos)) - (data (i32.const 0x203a0) "\90\03\02\00" "\03" "AND" "\4a\00\00\00") - (elem (i32.const 0x4a) $AND) + (data (i32.const 0x203b4) "\a4\03\02\00" "\03" "AND" "\4b\00\00\00") + (elem (i32.const 0x4b) $AND) ;; [6.1.0750](https://forth-standard.org/standard/core/BASE) - (data (i32.const 0x203ac) "\a0\03\02\00" "\44" (; F_DATA ;) "BASE " "\03\00\00\00" (; = pack(PUSH_DATA_ADDRESS_INDEX) ;) "\0a\00\00\00" (; = pack(10) ;)) + (data (i32.const 0x203c0) "\b4\03\02\00" "\44" (; F_DATA ;) "BASE " "\03\00\00\00" (; = pack(PUSH_DATA_ADDRESS_INDEX) ;) "\0a\00\00\00" (; = pack(10) ;)) ;; [6.1.0760](https://forth-standard.org/standard/core/BEGIN) (func $BEGIN (param $tos i32) (result i32) (local.get $tos) (call $ensureCompiling) (call $compileBegin)) - (data (i32.const 0x203c0) "\ac\03\02\00" "\85" (; F_IMMEDIATE ;) "BEGIN " "\4b\00\00\00") - (elem (i32.const 0x4b) $BEGIN) + (data (i32.const 0x203d4) "\c0\03\02\00" "\85" (; F_IMMEDIATE ;) "BEGIN " "\4c\00\00\00") + (elem (i32.const 0x4c) $BEGIN) ;; [6.1.0770](https://forth-standard.org/standard/core/BL) (func $BL (param $tos i32) (result i32) (call $push (local.get $tos) (i32.const 32))) - (data (i32.const 0x203d0) "\c0\03\02\00" "\02" "BL " "\4c\00\00\00") - (elem (i32.const 0x4c) $BL) + (data (i32.const 0x203e4) "\d4\03\02\00" "\02" "BL " "\4d\00\00\00") + (elem (i32.const 0x4d) $BL) ;; [6.2.0825](https://forth-standard.org/standard/core/BUFFERColon) (func $BUFFER: (param $tos i32) (result i32) (local.get $tos) (call $CREATE) (call $ALLOT)) - (data (i32.const 0x203dc) "\d0\03\02\00" "\07" "BUFFER:" "\4d\00\00\00") - (elem (i32.const 0x4d) $BUFFER:) + (data (i32.const 0x203f0) "\e4\03\02\00" "\07" "BUFFER:" "\4e\00\00\00") + (elem (i32.const 0x4e) $BUFFER:) ;; [6.1.0850](https://forth-standard.org/standard/core/CStore) (func $C! (param $tos i32) (result i32) @@ -912,8 +932,8 @@ (i32.store8 (i32.load (i32.sub (local.get $tos) (i32.const 4))) (i32.load (local.tee $bbtos (i32.sub (local.get $tos) (i32.const 8))))) (local.get $bbtos)) - (data (i32.const 0x203ec) "\dc\03\02\00" "\02" "C! " "\4e\00\00\00") - (elem (i32.const 0x4e) $C!) + (data (i32.const 0x20400) "\f0\03\02\00" "\02" "C! " "\4f\00\00\00") + (elem (i32.const 0x4f) $C!) ;; [6.1.0860](https://forth-standard.org/standard/core/CComma) (func $Cc (param $tos i32) (result i32) @@ -921,8 +941,8 @@ (i32.load (i32.sub (local.get $tos) (i32.const 4)))) (global.set $here (i32.add (global.get $here) (i32.const 1))) (i32.sub (local.get $tos) (i32.const 4))) - (data (i32.const 0x203f8) "\ec\03\02\00" "\02" "C, " "\4f\00\00\00") - (elem (i32.const 0x4f) $Cc) + (data (i32.const 0x2040c) "\00\04\02\00" "\02" "C, " "\50\00\00\00") + (elem (i32.const 0x50) $Cc) ;; [6.2.0855](https://forth-standard.org/standard/core/Cq) (func $Cq (param $tos i32) (result i32) @@ -940,8 +960,8 @@ (call $compilePushConst (global.get $here)) (global.set $here (call $aligned (i32.add (i32.add (global.get $here) (i32.const 1)) (local.get $len))))) - (data (i32.const 0x20404) "\f8\03\02\00" "\82" (; F_IMMEDIATE ;) "C\22 " "\50\00\00\00") - (elem (i32.const 0x50) $Cq) + (data (i32.const 0x20418) "\0c\04\02\00" "\82" (; F_IMMEDIATE ;) "C\22 " "\51\00\00\00") + (elem (i32.const 0x51) $Cq) ;; [6.1.0870](https://forth-standard.org/standard/core/CFetch) (func $C@ (param $tos i32) (result i32) @@ -949,8 +969,8 @@ (i32.store (local.tee $btos (i32.sub (local.get $tos) (i32.const 4))) (i32.load8_u (i32.load (local.get $btos)))) (local.get $tos)) - (data (i32.const 0x20410) "\04\04\02\00" "\02" "C@ " "\51\00\00\00") - (elem (i32.const 0x51) $C@) + (data (i32.const 0x20424) "\18\04\02\00" "\02" "C@ " "\52\00\00\00") + (elem (i32.const 0x52) $C@) ;; [6.1.0880](https://forth-standard.org/standard/core/CELLPlus) (func $CELL+ (param $tos i32) (result i32) @@ -958,8 +978,8 @@ (i32.store (local.tee $btos (i32.sub (local.get $tos) (i32.const 4))) (i32.add (i32.load (local.get $btos)) (i32.const 4))) (local.get $tos)) - (data (i32.const 0x2041c) "\10\04\02\00" "\05" "CELL+ " "\52\00\00\00") - (elem (i32.const 0x52) $CELL+) + (data (i32.const 0x20430) "\24\04\02\00" "\05" "CELL+ " "\53\00\00\00") + (elem (i32.const 0x53) $CELL+) ;; [6.1.0890](https://forth-standard.org/standard/core/CELLS) (func $CELLS (param $tos i32) (result i32) @@ -967,8 +987,8 @@ (i32.store (local.tee $btos (i32.sub (local.get $tos) (i32.const 4))) (i32.shl (i32.load (local.get $btos)) (i32.const 2))) (local.get $tos)) - (data (i32.const 0x2042c) "\1c\04\02\00" "\05" "CELLS " "\53\00\00\00") - (elem (i32.const 0x53) $CELLS) + (data (i32.const 0x20440) "\30\04\02\00" "\05" "CELLS " "\54\00\00\00") + (elem (i32.const 0x54) $CELLS) ;; [6.1.0895](https://forth-standard.org/standard/core/CHAR) (func $CHAR (param $tos i32) (result i32) @@ -980,26 +1000,26 @@ (call $fail (i32.const 0x2001d (; = str("incomplete input") ;))))) (i32.store (local.get $tos) (i32.load8_u (local.get $addr))) (i32.add (local.get $tos) (i32.const 4))) - (data (i32.const 0x2043c) "\2c\04\02\00" "\04" "CHAR " "\54\00\00\00") - (elem (i32.const 0x54) $CHAR) + (data (i32.const 0x20450) "\40\04\02\00" "\04" "CHAR " "\55\00\00\00") + (elem (i32.const 0x55) $CHAR) ;; [6.1.0897](https://forth-standard.org/standard/core/CHARPlus) (func $CHAR+ (param $tos i32) (result i32) (call $1+ (local.get $tos))) - (data (i32.const 0x2044c) "\3c\04\02\00" "\05" "CHAR+ " "\55\00\00\00") - (elem (i32.const 0x55) $CHAR+) + (data (i32.const 0x20460) "\50\04\02\00" "\05" "CHAR+ " "\56\00\00\00") + (elem (i32.const 0x56) $CHAR+) ;; [6.1.0898](https://forth-standard.org/standard/core/CHARS) (func $CHARS (param $tos i32) (result i32) (local.get $tos)) - (data (i32.const 0x2045c) "\4c\04\02\00" "\05" "CHARS " "\56\00\00\00") - (elem (i32.const 0x56) $CHARS) + (data (i32.const 0x20470) "\60\04\02\00" "\05" "CHARS " "\57\00\00\00") + (elem (i32.const 0x57) $CHARS) ;; [6.2.0945](https://forth-standard.org/standard/core/COMPILEComma) (func $COMPILEComma (param $tos i32) (result i32) (call $compileExecute (call $pop (local.get $tos)))) - (data (i32.const 0x2046c) "\5c\04\02\00" "\08" "COMPILE, " "\57\00\00\00") - (elem (i32.const 0x57) $COMPILEComma) + (data (i32.const 0x20480) "\70\04\02\00" "\08" "COMPILE, " "\58\00\00\00") + (elem (i32.const 0x58) $COMPILEComma) ;; [6.1.0950](https://forth-standard.org/standard/core/CONSTANT) (func $CONSTANT (param $tos i32) (result i32) @@ -1010,8 +1030,8 @@ (local.set $v (call $pop)) (i32.store (global.get $here) (local.get $v)) (global.set $here (i32.add (global.get $here) (i32.const 4)))) - (data (i32.const 0x20480) "\6c\04\02\00" "\08" "CONSTANT " "\58\00\00\00") - (elem (i32.const 0x58) $CONSTANT) + (data (i32.const 0x20494) "\80\04\02\00" "\08" "CONSTANT " "\59\00\00\00") + (elem (i32.const 0x59) $CONSTANT) ;; [6.1.0980](https://forth-standard.org/standard/core/COUNT) (func $COUNT (param $tos i32) (result i32) @@ -1022,15 +1042,15 @@ (i32.const 4))))))) (i32.store (local.get $btos) (i32.add (local.get $addr) (i32.const 1))) (i32.add (local.get $tos) (i32.const 4))) - (data (i32.const 0x20494) "\80\04\02\00" "\05" "COUNT " "\59\00\00\00") - (elem (i32.const 0x59) $COUNT) + (data (i32.const 0x204a8) "\94\04\02\00" "\05" "COUNT " "\5a\00\00\00") + (elem (i32.const 0x5a) $COUNT) ;; [6.1.0990](https://forth-standard.org/standard/core/CR) (func $CR (param $tos i32) (result i32) (call $shell_emit (i32.const 0x0a)) (local.get $tos)) - (data (i32.const 0x204a4) "\94\04\02\00" "\02" "CR " "\5a\00\00\00") - (elem (i32.const 0x5a) $CR) + (data (i32.const 0x204b8) "\a8\04\02\00" "\02" "CR " "\5b\00\00\00") + (elem (i32.const 0x5b) $CR) ;; [6.1.1000](https://forth-standard.org/standard/core/CREATE) (func $CREATE (param $tos i32) (result i32) @@ -1045,31 +1065,75 @@ (i32.const 0x40 (; = F_DATA ;)) (i32.const 0x3 (; = PUSH_DATA_ADDRESS_INDEX ;))) (local.get $tos)) - (data (i32.const 0x204b0) "\a4\04\02\00" "\06" "CREATE " "\5b\00\00\00") - (elem (i32.const 0x5b) $CREATE) + (data (i32.const 0x204c4) "\b8\04\02\00" "\06" "CREATE " "\5c\00\00\00") + (elem (i32.const 0x5c) $CREATE) ;; [6.1.1170](https://forth-standard.org/standard/core/DECIMAL) (func $DECIMAL (param $tos i32) (result i32) - (i32.store (i32.const 0x203bc (; = body(BASE) ;)) (i32.const 10)) + (i32.store (i32.const 0x203d0 (; = body(BASE) ;)) (i32.const 10)) (local.get $tos)) - (data (i32.const 0x204c0) "\b0\04\02\00" "\07" "DECIMAL" "\5c\00\00\00") - (elem (i32.const 0x5c) $DECIMAL) + (data (i32.const 0x204d4) "\c4\04\02\00" "\07" "DECIMAL" "\5d\00\00\00") + (elem (i32.const 0x5d) $DECIMAL) + + ;; [6.2.1173](https://forth-standard.org/standard/core/DEFER) + (func $DEFER (param $tos i32) (result i32) + (local $nameAddr i32) + (local $nameLen i32) + (local.set $nameAddr (local.set $nameLen (call $parseName))) + (if (i32.eqz (local.get $nameLen)) + (call $fail (i32.const 0x2001d (; = str("incomplete input") ;)))) + (call $create + (local.get $nameAddr) + (local.get $nameLen) + (i32.const 0x40 (; = F_DATA ;)) + (i32.const 0x8 (; = EXECUTE_DEFER_INDEX ;))) + (; Store `here` and `latest` pointer before this definition in the data + area of the word, so we can reset it in `$resetMarker` ;) + (global.set $here (i32.add (global.get $here) (i32.const 4))) + (local.get $tos)) + (data (i32.const 0x204e4) "\d4\04\02\00" "\05" "DEFER " "\5e\00\00\00") + (elem (i32.const 0x5e) $DEFER) + + ;; [6.2.1175](https://forth-standard.org/standard/core/DEFERStore) + (func $DEFER! (param $tos i32) (result i32) + (local $bbtos i32) + (i32.store + (i32.add + (call $body (i32.load (i32.sub (local.get $tos) (i32.const 4)))) + (i32.const 4)) + (i32.load (local.tee $bbtos (i32.sub (local.get $tos) (i32.const 8))))) + (local.get $bbtos)) + (data (i32.const 0x204f4) "\e4\04\02\00" "\06" "DEFER! " "\5f\00\00\00") + (elem (i32.const 0x5f) $DEFER!) + + ;; [6.2.1177](https://forth-standard.org/standard/core/DEFERFetch) + (func $DEFER@ (param $tos i32) (result i32) + (local $btos i32) + (i32.store + (local.tee $btos (i32.sub (local.get $tos) (i32.const 4))) + (i32.load + (i32.add + (call $body (i32.load (local.get $btos))) + (i32.const 4)))) + (local.get $tos)) + (data (i32.const 0x20504) "\f4\04\02\00" "\06" "DEFER@ " "\60\00\00\00") + (elem (i32.const 0x60) $DEFER@) ;; [6.1.1200](https://forth-standard.org/standard/core/DEPTH) (func $DEPTH (param $tos i32) (result i32) (i32.store (local.get $tos) (i32.shr_u (i32.sub (local.get $tos) (i32.const 0x10000 (; = STACK_BASE ;))) (i32.const 2))) (i32.add (local.get $tos) (i32.const 4))) - (data (i32.const 0x204d0) "\c0\04\02\00" "\05" "DEPTH " "\5d\00\00\00") - (elem (i32.const 0x5d) $DEPTH) + (data (i32.const 0x20514) "\04\05\02\00" "\05" "DEPTH " "\61\00\00\00") + (elem (i32.const 0x61) $DEPTH) ;; [6.1.1240](https://forth-standard.org/standard/core/DO) (func $DO (param $tos i32) (result i32) (local.get $tos) (call $ensureCompiling) (call $compileDo (i32.const 0))) - (data (i32.const 0x204e0) "\d0\04\02\00" "\82" (; F_IMMEDIATE ;) "DO " "\5e\00\00\00") - (elem (i32.const 0x5e) $DO) + (data (i32.const 0x20524) "\14\05\02\00" "\82" (; F_IMMEDIATE ;) "DO " "\62\00\00\00") + (elem (i32.const 0x62) $DO) ;; [6.1.1250](https://forth-standard.org/standard/core/DOES) (func $DOES> (param $tos i32) (result i32) @@ -1080,37 +1144,37 @@ (call $endColon) (call $startColon (i32.const 1)) (call $compilePushLocal (i32.const 1))) - (data (i32.const 0x204ec) "\e0\04\02\00" "\85" (; F_IMMEDIATE ;) "DOES> " "\5f\00\00\00") - (elem (i32.const 0x5f) $DOES>) + (data (i32.const 0x20530) "\24\05\02\00" "\85" (; F_IMMEDIATE ;) "DOES> " "\63\00\00\00") + (elem (i32.const 0x63) $DOES>) ;; [6.1.1260](https://forth-standard.org/standard/core/DROP) (func $DROP (param $tos i32) (result i32) (i32.sub (local.get $tos) (i32.const 4))) - (data (i32.const 0x204fc) "\ec\04\02\00" "\04" "DROP " "\60\00\00\00") - (elem (i32.const 0x60) $DROP) + (data (i32.const 0x20540) "\30\05\02\00" "\04" "DROP " "\64\00\00\00") + (elem (i32.const 0x64) $DROP) ;; [6.1.1290](https://forth-standard.org/standard/core/DUP) (func $DUP (param $tos i32) (result i32) (i32.store (local.get $tos) (i32.load (i32.sub (local.get $tos) (i32.const 4)))) (i32.add (local.get $tos) (i32.const 4))) - (data (i32.const 0x2050c) "\fc\04\02\00" "\03" "DUP" "\61\00\00\00") - (elem (i32.const 0x61) $DUP) + (data (i32.const 0x20550) "\40\05\02\00" "\03" "DUP" "\65\00\00\00") + (elem (i32.const 0x65) $DUP) ;; [6.1.1310](https://forth-standard.org/standard/core/ELSE) (func $ELSE (param $tos i32) (result i32) (local.get $tos) (call $ensureCompiling) (call $emitElse)) - (data (i32.const 0x20518) "\0c\05\02\00" "\84" (; F_IMMEDIATE ;) "ELSE " "\62\00\00\00") - (elem (i32.const 0x62) $ELSE) + (data (i32.const 0x2055c) "\50\05\02\00" "\84" (; F_IMMEDIATE ;) "ELSE " "\66\00\00\00") + (elem (i32.const 0x66) $ELSE) ;; [6.1.1320](https://forth-standard.org/standard/core/EMIT) (func $EMIT (param $tos i32) (result i32) (call $shell_emit (i32.load (i32.sub (local.get $tos) (i32.const 4)))) (i32.sub (local.get $tos) (i32.const 4))) - (data (i32.const 0x20528) "\18\05\02\00" "\04" "EMIT " "\63\00\00\00") - (elem (i32.const 0x63) $EMIT) + (data (i32.const 0x2056c) "\5c\05\02\00" "\04" "EMIT " "\67\00\00\00") + (elem (i32.const 0x67) $EMIT) ;; [6.1.1345](https://forth-standard.org/standard/core/ENVIRONMENTq) (func $ENVIRONMENT? (param $tos i32) (result i32) @@ -1134,8 +1198,8 @@ (else (i32.store (local.get $bbtos) (i32.const 0)) (local.get $btos)))))) - (data (i32.const 0x20538) "\28\05\02\00" "\0c" "ENVIRONMENT? " "\64\00\00\00") - (elem (i32.const 0x64) $ENVIRONMENT?) + (data (i32.const 0x2057c) "\6c\05\02\00" "\0c" "ENVIRONMENT? " "\68\00\00\00") + (elem (i32.const 0x68) $ENVIRONMENT?) ;; [6.2.1350](https://forth-standard.org/standard/core/ERASE) (func $ERASE (param $tos i32) (result i32) @@ -1145,8 +1209,8 @@ (i32.const 0) (i32.load (i32.sub (local.get $tos) (i32.const 4)))) (local.get $bbtos)) - (data (i32.const 0x20550) "\38\05\02\00" "\05" "ERASE " "\65\00\00\00") - (elem (i32.const 0x65) $ERASE) + (data (i32.const 0x20594) "\7c\05\02\00" "\05" "ERASE " "\69\00\00\00") + (elem (i32.const 0x69) $ERASE) ;; [6.1.1360](https://forth-standard.org/standard/core/EVALUATE) (func $EVALUATE (param $tos i32) (result i32) @@ -1174,28 +1238,28 @@ (i32.store (i32.const 0x202f8 (; = body(>IN) ;)) (local.get $prevIn)) (global.set $inputBufferBase (local.get $prevInputBufferBase)) (global.set $inputBufferSize (local.get $prevInputBufferSize))) - (data (i32.const 0x20560) "\50\05\02\00" "\08" "EVALUATE " "\66\00\00\00") - (elem (i32.const 0x66) $EVALUATE) + (data (i32.const 0x205a4) "\94\05\02\00" "\08" "EVALUATE " "\6a\00\00\00") + (elem (i32.const 0x6a) $EVALUATE) ;; [6.1.1370](https://forth-standard.org/standard/core/EXECUTE) (func $EXECUTE (param $tos i32) (result i32) (call $execute (call $pop (local.get $tos)))) - (data (i32.const 0x20574) "\60\05\02\00" "\07" "EXECUTE" "\67\00\00\00") - (elem (i32.const 0x67) $EXECUTE) + (data (i32.const 0x205b8) "\a4\05\02\00" "\07" "EXECUTE" "\6b\00\00\00") + (elem (i32.const 0x6b) $EXECUTE) ;; [6.1.1380](https://forth-standard.org/standard/core/EXIT) (func $EXIT (param $tos i32) (result i32) (local.get $tos) (call $ensureCompiling) (call $emitReturn)) - (data (i32.const 0x20584) "\74\05\02\00" "\84" (; F_IMMEDIATE ;) "EXIT " "\68\00\00\00") - (elem (i32.const 0x68) $EXIT) + (data (i32.const 0x205c8) "\b8\05\02\00" "\84" (; F_IMMEDIATE ;) "EXIT " "\6c\00\00\00") + (elem (i32.const 0x6c) $EXIT) ;; [6.2.1485](https://forth-standard.org/standard/core/FALSE) (func $FALSE (param $tos i32) (result i32) (call $push (local.get $tos) (i32.const 0x0))) - (data (i32.const 0x20594) "\84\05\02\00" "\05" "FALSE " "\69\00\00\00") - (elem (i32.const 0x69) $FALSE) + (data (i32.const 0x205d8) "\c8\05\02\00" "\05" "FALSE " "\6d\00\00\00") + (elem (i32.const 0x6d) $FALSE) ;; [6.1.1540](https://forth-standard.org/standard/core/FILL) (func $FILL (param $tos i32) (result i32) @@ -1205,8 +1269,8 @@ (i32.load (i32.sub (local.get $tos) (i32.const 4))) (i32.load (i32.sub (local.get $tos) (i32.const 8)))) (local.get $bbbtos)) - (data (i32.const 0x205a4) "\94\05\02\00" "\04" "FILL " "\6a\00\00\00") - (elem (i32.const 0x6a) $FILL) + (data (i32.const 0x205e8) "\d8\05\02\00" "\04" "FILL " "\6e\00\00\00") + (elem (i32.const 0x6e) $FILL) ;; [6.1.1550](https://forth-standard.org/standard/core/FIND) (func $FIND (param $tos i32) (result i32) @@ -1222,8 +1286,8 @@ (else (i32.store (i32.sub (local.get $tos) (i32.const 4)) (local.get $xt)))) (i32.store (local.get $tos) (local.get $r)) (i32.add (local.get $tos) (i32.const 4))) - (data (i32.const 0x205b4) "\a4\05\02\00" "\04" "FIND " "\6b\00\00\00") - (elem (i32.const 0x6b) $FIND) + (data (i32.const 0x205f8) "\e8\05\02\00" "\04" "FIND " "\6f\00\00\00") + (elem (i32.const 0x6f) $FIND) ;; [6.1.1561](https://forth-standard.org/standard/core/FMDivMOD) (func $FM/MOD (param $tos i32) (result i32) @@ -1250,22 +1314,22 @@ (i32.store (local.get $bbbtos) (local.get $mod)) (i32.store (i32.sub (local.get $tos) (i32.const 8)) (local.get $q)) (local.get $btos)) - (data (i32.const 0x205c4) "\b4\05\02\00" "\06" "FM/MOD " "\6c\00\00\00") - (elem (i32.const 0x6c) $FM/MOD) + (data (i32.const 0x20608) "\f8\05\02\00" "\06" "FM/MOD " "\70\00\00\00") + (elem (i32.const 0x70) $FM/MOD) ;; [6.1.1650](https://forth-standard.org/standard/core/HERE) (func $HERE (param $tos i32) (result i32) (i32.store (local.get $tos) (global.get $here)) (i32.add (local.get $tos) (i32.const 4))) - (data (i32.const 0x205d4) "\c4\05\02\00" "\04" "HERE " "\6d\00\00\00") - (elem (i32.const 0x6d) $HERE) + (data (i32.const 0x20618) "\08\06\02\00" "\04" "HERE " "\71\00\00\00") + (elem (i32.const 0x71) $HERE) ;; [6.2.1660](https://forth-standard.org/standard/core/HEX) (func $HEX (param $tos i32) (result i32) - (i32.store (i32.const 0x203bc (; = body(BASE) ;)) (i32.const 16)) + (i32.store (i32.const 0x203d0 (; = body(BASE) ;)) (i32.const 16)) (local.get $tos)) - (data (i32.const 0x205e4) "\d4\05\02\00" "\03" "HEX" "\6e\00\00\00") - (elem (i32.const 0x6e) $HEX) + (data (i32.const 0x20628) "\18\06\02\00" "\03" "HEX" "\72\00\00\00") + (elem (i32.const 0x72) $HEX) ;; [6.1.1670](https://forth-standard.org/standard/core/HOLD) (func $HOLD (param $tos i32) (result i32) @@ -1276,8 +1340,8 @@ (i32.load (local.tee $btos (i32.sub (local.get $tos) (i32.const 4))))) (global.set $po (local.get $npo)) (local.get $btos)) - (data (i32.const 0x205f0) "\e4\05\02\00" "\04" "HOLD " "\6f\00\00\00") - (elem (i32.const 0x6f) $HOLD) + (data (i32.const 0x20634) "\28\06\02\00" "\04" "HOLD " "\73\00\00\00") + (elem (i32.const 0x73) $HOLD) ;; [6.2.1675](https://forth-standard.org/standard/core/HOLDS) (func $HOLDS (param $tos i32) (result i32) @@ -1292,23 +1356,23 @@ (local.get $len)) (global.set $po (local.get $npo)) (i32.sub (local.get $tos) (i32.const 8))) - (data (i32.const 0x20600) "\f0\05\02\00" "\05" "HOLDS " "\70\00\00\00") - (elem (i32.const 0x70) $HOLDS) + (data (i32.const 0x20644) "\34\06\02\00" "\05" "HOLDS " "\74\00\00\00") + (elem (i32.const 0x74) $HOLDS) ;; [6.1.1680](https://forth-standard.org/standard/core/I) (func $I (param $tos i32) (result i32) (i32.store (local.get $tos) (i32.load (i32.sub (global.get $tors) (i32.const 4)))) (i32.add (local.get $tos) (i32.const 4))) - (data (i32.const 0x20610) "\00\06\02\00" "\01" "I " "\71\00\00\00") - (elem (i32.const 0x71) $I) + (data (i32.const 0x20654) "\44\06\02\00" "\01" "I " "\75\00\00\00") + (elem (i32.const 0x75) $I) ;; [6.1.1700](https://forth-standard.org/standard/core/IF) (func $IF (param $tos i32) (result i32) (local.get $tos) (call $ensureCompiling) (call $compileIf)) - (data (i32.const 0x2061c) "\10\06\02\00" "\82" (; F_IMMEDIATE ;) "IF " "\72\00\00\00") - (elem (i32.const 0x72) $IF) + (data (i32.const 0x20660) "\54\06\02\00" "\82" (; F_IMMEDIATE ;) "IF " "\76\00\00\00") + (elem (i32.const 0x76) $IF) ;; [6.1.1710](https://forth-standard.org/standard/core/IMMEDIATE) (func $IMMEDIATE (param $tos i32) (result i32) @@ -1317,8 +1381,8 @@ (i32.load (i32.add (global.get $latest) (i32.const 4))) (i32.const 0x80 (; = F_IMMEDIATE ;)))) (local.get $tos)) - (data (i32.const 0x20628) "\1c\06\02\00" "\09" "IMMEDIATE " "\73\00\00\00") - (elem (i32.const 0x73) $IMMEDIATE) + (data (i32.const 0x2066c) "\60\06\02\00" "\09" "IMMEDIATE " "\77\00\00\00") + (elem (i32.const 0x77) $IMMEDIATE) ;; [6.1.1720](https://forth-standard.org/standard/core/INVERT) (func $INVERT (param $tos i32) (result i32) @@ -1326,52 +1390,84 @@ (i32.store (local.tee $btos (i32.sub (local.get $tos) (i32.const 4))) (i32.xor (i32.load (local.get $btos)) (i32.const -1))) (local.get $tos)) - (data (i32.const 0x2063c) "\28\06\02\00" "\06" "INVERT " "\74\00\00\00") - (elem (i32.const 0x74) $INVERT) + (data (i32.const 0x20680) "\6c\06\02\00" "\06" "INVERT " "\78\00\00\00") + (elem (i32.const 0x78) $INVERT) + + ;; [6.2.1725](https://forth-standard.org/standard/core/IS) + (func $IS (param $tos i32) (result i32) + (local $xtp i32) + (local $btos i32) + (local.set $xtp + (i32.add + (call $body (drop (call $find! (call $parseName)))) + (i32.const 4))) + (if (result i32) (i32.eqz (i32.load (i32.const 0x20900 (; = body(STATE) ;)))) + (then + (i32.store (local.get $xtp) + (i32.load (local.tee $btos (i32.sub (local.get $tos) (i32.const 4))))) + (local.get $btos)) + (else + (call $emitSetLocal (i32.const 0)) ;; Save tos currently on operand stack + + ;; Push parameter pointer on operand stack + (call $emitConst (local.get $xtp)) + + ;; Pop value from stack & push on operand stack + (call $emitGetLocal (i32.const 0)) + (call $emitConst (i32.const 4)) + (call $emitSub) + (call $emitTeeLocal (i32.const 0)) + (call $emitLoad) + + (call $emitStore) + (call $emitGetLocal (i32.const 0)) ;; Put tos on operand stack again + (local.get $tos)))) + (data (i32.const 0x20690) "\80\06\02\00" "\82" (; F_IMMEDIATE ;) "IS " "\79\00\00\00") + (elem (i32.const 0x79) $IS) ;; [6.1.1730](https://forth-standard.org/standard/core/J) (func $J (param $tos i32) (result i32) (i32.store (local.get $tos) (i32.load (i32.sub (global.get $tors) (i32.const 8)))) (i32.add (local.get $tos) (i32.const 4))) - (data (i32.const 0x2064c) "\3c\06\02\00" "\01" "J " "\75\00\00\00") - (elem (i32.const 0x75) $J) + (data (i32.const 0x2069c) "\90\06\02\00" "\01" "J " "\7a\00\00\00") + (elem (i32.const 0x7a) $J) ;; [6.1.1750](https://forth-standard.org/standard/core/KEY) (func $KEY (param $tos i32) (result i32) (i32.store (local.get $tos) (call $shell_key)) (i32.add (local.get $tos) (i32.const 4))) - (data (i32.const 0x20658) "\4c\06\02\00" "\03" "KEY" "\76\00\00\00") - (elem (i32.const 0x76) $KEY) + (data (i32.const 0x206a8) "\9c\06\02\00" "\03" "KEY" "\7b\00\00\00") + (elem (i32.const 0x7b) $KEY) (func $LATEST (param $tos i32) (result i32) (i32.store (local.get $tos) (global.get $latest)) (i32.add (local.get $tos) (i32.const 4))) - (data (i32.const 0x20664) "\58\06\02\00" "\06" "LATEST " "\77\00\00\00") - (elem (i32.const 0x77) $LATEST) + (data (i32.const 0x206b4) "\a8\06\02\00" "\06" "LATEST " "\7c\00\00\00") + (elem (i32.const 0x7c) $LATEST) ;; [6.1.1760](https://forth-standard.org/standard/core/LEAVE) (func $LEAVE (param $tos i32) (result i32) (local.get $tos) (call $ensureCompiling) (call $compileLeave)) - (data (i32.const 0x20674) "\64\06\02\00" "\85" (; F_IMMEDIATE ;) "LEAVE " "\78\00\00\00") - (elem (i32.const 0x78) $LEAVE) + (data (i32.const 0x206c4) "\b4\06\02\00" "\85" (; F_IMMEDIATE ;) "LEAVE " "\7d\00\00\00") + (elem (i32.const 0x7d) $LEAVE) ;; [6.1.1780](https://forth-standard.org/standard/core/LITERAL) (func $LITERAL (param $tos i32) (result i32) (local.get $tos) (call $ensureCompiling) (call $compilePushConst (call $pop))) - (data (i32.const 0x20684) "\74\06\02\00" "\87" (; F_IMMEDIATE ;) "LITERAL" "\79\00\00\00") - (elem (i32.const 0x79) $LITERAL) + (data (i32.const 0x206d4) "\c4\06\02\00" "\87" (; F_IMMEDIATE ;) "LITERAL" "\7e\00\00\00") + (elem (i32.const 0x7e) $LITERAL) ;; [6.1.1800](https://forth-standard.org/standard/core/LOOP) (func $LOOP (param $tos i32) (result i32) (local.get $tos) (call $ensureCompiling) (call $compileLoop)) - (data (i32.const 0x20694) "\84\06\02\00" "\84" (; F_IMMEDIATE ;) "LOOP " "\7a\00\00\00") - (elem (i32.const 0x7a) $LOOP) + (data (i32.const 0x206e4) "\d4\06\02\00" "\84" (; F_IMMEDIATE ;) "LOOP " "\7f\00\00\00") + (elem (i32.const 0x7f) $LOOP) ;; [6.1.1805](https://forth-standard.org/standard/core/LSHIFT) (func $LSHIFT (param $tos i32) (result i32) @@ -1381,8 +1477,8 @@ (i32.shl (i32.load (local.get $bbtos)) (i32.load (local.tee $btos (i32.sub (local.get $tos) (i32.const 4)))))) (local.get $btos)) - (data (i32.const 0x206a4) "\94\06\02\00" "\06" "LSHIFT " "\7b\00\00\00") - (elem (i32.const 0x7b) $LSHIFT) + (data (i32.const 0x206f4) "\e4\06\02\00" "\06" "LSHIFT " "\80\00\00\00") + (elem (i32.const 0x80) $LSHIFT) ;; [6.1.1810](https://forth-standard.org/standard/core/MTimes) (func $M* (param $tos i32) (result i32) @@ -1392,8 +1488,8 @@ (i64.extend_i32_s (i32.load (i32.sub (local.get $tos) (i32.const 4)))))) (local.get $tos)) - (data (i32.const 0x206b4) "\a4\06\02\00" "\02" "M* " "\7c\00\00\00") - (elem (i32.const 0x7c) $M*) + (data (i32.const 0x20704) "\f4\06\02\00" "\02" "M* " "\81\00\00\00") + (elem (i32.const 0x81) $M*) ;; [16.2.1850](https://forth-standard.org/standard/core/MARKER) (func $MARKER (param $tos i32) (result i32) @@ -1417,8 +1513,8 @@ (i32.store (i32.add (global.get $here) (i32.const 4)) (local.get $oldLatest)) (global.set $here (i32.add (global.get $here) (i32.const 8))) (local.get $tos)) - (data (i32.const 0x206c0) "\b4\06\02\00" "\06" "MARKER " "\7d\00\00\00") - (elem (i32.const 0x7d) $MARKER) + (data (i32.const 0x20710) "\04\07\02\00" "\06" "MARKER " "\82\00\00\00") + (elem (i32.const 0x82) $MARKER) ;; [6.1.1870](https://forth-standard.org/standard/core/MAX) (func $MAX (param $tos i32) (result i32) @@ -1431,8 +1527,8 @@ (then (i32.store (local.get $bbtos) (local.get $v)))) (local.get $btos)) - (data (i32.const 0x206d0) "\c0\06\02\00" "\03" "MAX" "\7e\00\00\00") - (elem (i32.const 0x7e) $MAX) + (data (i32.const 0x20720) "\10\07\02\00" "\03" "MAX" "\83\00\00\00") + (elem (i32.const 0x83) $MAX) ;; [6.1.1880](https://forth-standard.org/standard/core/MIN) (func $MIN (param $tos i32) (result i32) @@ -1445,8 +1541,8 @@ (then (i32.store (local.get $bbtos) (local.get $v)))) (local.get $btos)) - (data (i32.const 0x206dc) "\d0\06\02\00" "\03" "MIN" "\7f\00\00\00") - (elem (i32.const 0x7f) $MIN) + (data (i32.const 0x2072c) "\20\07\02\00" "\03" "MIN" "\84\00\00\00") + (elem (i32.const 0x84) $MIN) ;; [6.1.1890](https://forth-standard.org/standard/core/MOD) (func $MOD (param $tos i32) (result i32) @@ -1456,8 +1552,8 @@ (i32.rem_s (i32.load (local.get $bbtos)) (i32.load (local.tee $btos (i32.sub (local.get $tos) (i32.const 4)))))) (local.get $btos)) - (data (i32.const 0x206e8) "\dc\06\02\00" "\03" "MOD" "\80\00\00\00") - (elem (i32.const 0x80) $MOD) + (data (i32.const 0x20738) "\2c\07\02\00" "\03" "MOD" "\85\00\00\00") + (elem (i32.const 0x85) $MOD) ;; [6.1.1900](https://forth-standard.org/standard/core/MOVE) (func $MOVE (param $tos i32) (result i32) @@ -1467,8 +1563,8 @@ (i32.load (local.tee $bbbtos (i32.sub (local.get $tos) (i32.const 12)))) (i32.load (i32.sub (local.get $tos) (i32.const 4)))) (local.get $bbbtos)) - (data (i32.const 0x206f4) "\e8\06\02\00" "\04" "MOVE " "\81\00\00\00") - (elem (i32.const 0x81) $MOVE) + (data (i32.const 0x20744) "\38\07\02\00" "\04" "MOVE " "\86\00\00\00") + (elem (i32.const 0x86) $MOVE) ;; [6.1.1910](https://forth-standard.org/standard/core/NEGATE) (func $NEGATE (param $tos i32) (result i32) @@ -1476,8 +1572,8 @@ (i32.store (local.tee $btos (i32.sub (local.get $tos) (i32.const 4))) (i32.sub (i32.const 0) (i32.load (local.get $btos)))) (local.get $tos)) - (data (i32.const 0x20704) "\f4\06\02\00" "\06" "NEGATE " "\82\00\00\00") - (elem (i32.const 0x82) $NEGATE) + (data (i32.const 0x20754) "\44\07\02\00" "\06" "NEGATE " "\87\00\00\00") + (elem (i32.const 0x87) $NEGATE) ;; [6.2.1930](https://forth-standard.org/standard/core/NIP) (func $NIP (param $tos i32) (result i32) @@ -1485,8 +1581,8 @@ (i32.store (i32.sub (local.get $tos) (i32.const 8)) (i32.load (local.tee $btos (i32.sub (local.get $tos) (i32.const 4))))) (local.get $btos)) - (data (i32.const 0x20714) "\04\07\02\00" "\03" "NIP" "\83\00\00\00") - (elem (i32.const 0x83) $NIP) + (data (i32.const 0x20764) "\54\07\02\00" "\03" "NIP" "\88\00\00\00") + (elem (i32.const 0x88) $NIP) ;; [6.1.1980](https://forth-standard.org/standard/core/OR) (func $OR (param $tos i32) (result i32) @@ -1496,23 +1592,23 @@ (i32.or (i32.load (local.tee $btos (i32.sub (local.get $tos) (i32.const 4)))) (i32.load (local.get $bbtos)))) (local.get $btos)) - (data (i32.const 0x20720) "\14\07\02\00" "\02" "OR " "\84\00\00\00") - (elem (i32.const 0x84) $OR) + (data (i32.const 0x20770) "\64\07\02\00" "\02" "OR " "\89\00\00\00") + (elem (i32.const 0x89) $OR) ;; [6.1.1990](https://forth-standard.org/standard/core/OVER) (func $OVER (param $tos i32) (result i32) (i32.store (local.get $tos) (i32.load (i32.sub (local.get $tos) (i32.const 8)))) (i32.add (local.get $tos) (i32.const 4))) - (data (i32.const 0x2072c) "\20\07\02\00" "\04" "OVER " "\85\00\00\00") - (elem (i32.const 0x85) $OVER) + (data (i32.const 0x2077c) "\70\07\02\00" "\04" "OVER " "\8a\00\00\00") + (elem (i32.const 0x8a) $OVER) ;; [6.2.2000](https://forth-standard.org/standard/core/PAD) (func $PAD (param $tos i32) (result i32) (i32.store (local.get $tos) (i32.add (global.get $here) (i32.const 0x304 (; = PAD_OFFSET ;)))) (i32.add (local.get $tos) (i32.const 0x4))) - (data (i32.const 0x2073c) "\2c\07\02\00" "\03" "PAD" "\86\00\00\00") - (elem (i32.const 0x86) $PAD) + (data (i32.const 0x2078c) "\7c\07\02\00" "\03" "PAD" "\8b\00\00\00") + (elem (i32.const 0x8b) $PAD) ;; [6.2.2008](https://forth-standard.org/standard/core/PARSE) (func $PARSE (param $tos i32) (result i32) @@ -1525,8 +1621,8 @@ (i32.store (local.get $btos) (local.get $addr)) (i32.store (local.get $tos) (local.get $len)) (i32.add (local.get $tos) (i32.const 0x4))) - (data (i32.const 0x20748) "\3c\07\02\00" "\05" "PARSE " "\87\00\00\00") - (elem (i32.const 0x87) $PARSE) + (data (i32.const 0x20798) "\8c\07\02\00" "\05" "PARSE " "\8c\00\00\00") + (elem (i32.const 0x8c) $PARSE) ;; [6.2.2020](https://forth-standard.org/standard/core/PARSE-NAME) (func $PARSE-NAME (param $tos i32) (result i32) @@ -1536,8 +1632,8 @@ (i32.store (local.get $tos) (local.get $addr)) (i32.store (i32.add (local.get $tos) (i32.const 0x4)) (local.get $len)) (i32.add (local.get $tos) (i32.const 0x8))) - (data (i32.const 0x20758) "\48\07\02\00" "\0a" "PARSE-NAME " "\88\00\00\00") - (elem (i32.const 0x88) $PARSE-NAME) + (data (i32.const 0x207a8) "\98\07\02\00" "\0a" "PARSE-NAME " "\8d\00\00\00") + (elem (i32.const 0x8d) $PARSE-NAME) ;; [6.2.2030](https://forth-standard.org/standard/core/PICK) (func $PICK (param $tos i32) (result i32) @@ -1548,8 +1644,8 @@ (local.get $tos) (i32.shl (i32.add (i32.load (local.get $btos)) (i32.const 2)) (i32.const 2))))) (local.get $tos)) - (data (i32.const 0x2076c) "\58\07\02\00" "\04" "PICK " "\89\00\00\00") - (elem (i32.const 0x89) $PICK) + (data (i32.const 0x207bc) "\a8\07\02\00" "\04" "PICK " "\8e\00\00\00") + (elem (i32.const 0x8e) $PICK) ;; [6.1.2033](https://forth-standard.org/standard/core/POSTPONE) (func $POSTPONE (param $tos i32) (result i32) @@ -1564,38 +1660,38 @@ (else (call $emitConst (local.get $FINDToken)) (call $compileCall (i32.const 1) (i32.const 0x5 (; = COMPILE_EXECUTE_INDEX ;)))))) - (data (i32.const 0x2077c) "\6c\07\02\00" "\88" (; F_IMMEDIATE ;) "POSTPONE " "\8a\00\00\00") - (elem (i32.const 0x8a) $POSTPONE) + (data (i32.const 0x207cc) "\bc\07\02\00" "\88" (; F_IMMEDIATE ;) "POSTPONE " "\8f\00\00\00") + (elem (i32.const 0x8f) $POSTPONE) ;; [6.1.2050](https://forth-standard.org/standard/core/QUIT) (func $QUIT (param $tos i32) (result i32) (global.set $error (i32.const 0x2 (; = ERR_QUIT ;))) (call $quit (local.get $tos))) - (data (i32.const 0x20790) "\7c\07\02\00" "\04" "QUIT " "\8b\00\00\00") - (elem (i32.const 0x8b) $QUIT) + (data (i32.const 0x207e0) "\cc\07\02\00" "\04" "QUIT " "\90\00\00\00") + (elem (i32.const 0x90) $QUIT) ;; [6.1.2060](https://forth-standard.org/standard/core/Rfrom) (func $R> (param $tos i32) (result i32) (global.set $tors (i32.sub (global.get $tors) (i32.const 4))) (i32.store (local.get $tos) (i32.load (global.get $tors))) (i32.add (local.get $tos) (i32.const 4))) - (data (i32.const 0x207a0) "\90\07\02\00" "\02" "R> " "\8c\00\00\00") - (elem (i32.const 0x8c) $R>) + (data (i32.const 0x207f0) "\e0\07\02\00" "\02" "R> " "\91\00\00\00") + (elem (i32.const 0x91) $R>) ;; [6.1.2070](https://forth-standard.org/standard/core/RFetch) (func $R@ (param $tos i32) (result i32) (i32.store (local.get $tos) (i32.load (i32.sub (global.get $tors) (i32.const 4)))) (i32.add (local.get $tos) (i32.const 4))) - (data (i32.const 0x207ac) "\a0\07\02\00" "\02" "R@ " "\8d\00\00\00") - (elem (i32.const 0x8d) $R@) + (data (i32.const 0x207fc) "\f0\07\02\00" "\02" "R@ " "\92\00\00\00") + (elem (i32.const 0x92) $R@) ;; [6.1.2120](https://forth-standard.org/standard/core/RECURSE) (func $RECURSE (param $tos i32) (result i32) (local.get $tos) (call $ensureCompiling) (call $compileRecurse)) - (data (i32.const 0x207b8) "\ac\07\02\00" "\87" (; F_IMMEDIATE ;) "RECURSE" "\8e\00\00\00") - (elem (i32.const 0x8e) $RECURSE) + (data (i32.const 0x20808) "\fc\07\02\00" "\87" (; F_IMMEDIATE ;) "RECURSE" "\93\00\00\00") + (elem (i32.const 0x93) $RECURSE) ;; [6.2.2125](https://forth-standard.org/standard/core/REFILL) (func $REFILL (param $tos i32) (result i32) @@ -1614,16 +1710,16 @@ (if (param i32) (result i32) (i32.eqz (global.get $inputBufferSize)) (then (call $push (i32.const 0))) (else (call $push (i32.const -1))))) - (data (i32.const 0x207c8) "\b8\07\02\00" "\06" "REFILL " "\8f\00\00\00") - (elem (i32.const 0x8f) $REFILL) + (data (i32.const 0x20818) "\08\08\02\00" "\06" "REFILL " "\94\00\00\00") + (elem (i32.const 0x94) $REFILL) ;; [6.1.2140](https://forth-standard.org/standard/core/REPEAT) (func $REPEAT (param $tos i32) (result i32) (local.get $tos) (call $ensureCompiling) (call $compileRepeat)) - (data (i32.const 0x207d8) "\c8\07\02\00" "\86" (; F_IMMEDIATE ;) "REPEAT " "\90\00\00\00") - (elem (i32.const 0x90) $REPEAT) + (data (i32.const 0x20828) "\18\08\02\00" "\86" (; F_IMMEDIATE ;) "REPEAT " "\95\00\00\00") + (elem (i32.const 0x95) $REPEAT) ;; [6.1.2150](https://forth-standard.org/standard/core/ROLL) (func $ROLL (param $tos i32) (result i32) @@ -1645,8 +1741,8 @@ (i32.shl (local.get $u) (i32.const 2))) (i32.store (i32.sub (local.get $tos) (i32.const 8)) (local.get $x)) (local.get $btos)) - (data (i32.const 0x207e8) "\d8\07\02\00" "\04" "ROLL " "\91\00\00\00") - (elem (i32.const 0x91) $ROLL) + (data (i32.const 0x20838) "\28\08\02\00" "\04" "ROLL " "\96\00\00\00") + (elem (i32.const 0x96) $ROLL) ;; [6.1.2160](https://forth-standard.org/standard/core/ROT) (func $ROT (param $tos i32) (result i32) @@ -1661,8 +1757,8 @@ (i32.load (local.tee $bbtos (i32.sub (local.get $tos) (i32.const 8))))) (i32.store (local.get $bbtos) (local.get $tmp)) (local.get $tos)) - (data (i32.const 0x207f8) "\e8\07\02\00" "\03" "ROT" "\92\00\00\00") - (elem (i32.const 0x92) $ROT) + (data (i32.const 0x20848) "\38\08\02\00" "\03" "ROT" "\97\00\00\00") + (elem (i32.const 0x97) $ROT) ;; [6.1.2162](https://forth-standard.org/standard/core/RSHIFT) (func $RSHIFT (param $tos i32) (result i32) @@ -1672,8 +1768,8 @@ (i32.shr_u (i32.load (local.get $bbtos)) (i32.load (local.tee $btos (i32.sub (local.get $tos) (i32.const 4)))))) (local.get $btos)) - (data (i32.const 0x20804) "\f8\07\02\00" "\06" "RSHIFT " "\93\00\00\00") - (elem (i32.const 0x93) $RSHIFT) + (data (i32.const 0x20854) "\48\08\02\00" "\06" "RSHIFT " "\98\00\00\00") + (elem (i32.const 0x98) $RSHIFT) ;; [6.1.2165](https://forth-standard.org/standard/core/Sq) (func $Sq (param $tos i32) (result i32) @@ -1688,8 +1784,8 @@ (call $compilePushConst (local.get $len)) (global.set $here (call $aligned (i32.add (global.get $here) (local.get $len))))) - (data (i32.const 0x20814) "\04\08\02\00" "\82" (; F_IMMEDIATE ;) "S\22 " "\94\00\00\00") - (elem (i32.const 0x94) $Sq) + (data (i32.const 0x20864) "\54\08\02\00" "\82" (; F_IMMEDIATE ;) "S\22 " "\99\00\00\00") + (elem (i32.const 0x99) $Sq) ;; [6.1.2170](https://forth-standard.org/standard/core/StoD) (func $S>D (param $tos i32) (result i32) @@ -1697,15 +1793,15 @@ (i64.store (local.tee $btos (i32.sub (local.get $tos) (i32.const 4))) (i64.extend_i32_s (i32.load (local.get $btos)))) (i32.add (local.get $tos) (i32.const 4))) - (data (i32.const 0x20820) "\14\08\02\00" "\03" "S>D" "\95\00\00\00") - (elem (i32.const 0x95) $S>D) + (data (i32.const 0x20870) "\64\08\02\00" "\03" "S>D" "\9a\00\00\00") + (elem (i32.const 0x9a) $S>D) (func $SCALL (param $tos i32) (result i32) (global.set $tos (local.get $tos)) (call $shell_call) (global.get $tos)) - (data (i32.const 0x2082c) "\20\08\02\00" "\05" "SCALL " "\96\00\00\00") - (elem (i32.const 0x96) $SCALL) + (data (i32.const 0x2087c) "\70\08\02\00" "\05" "SCALL " "\9b\00\00\00") + (elem (i32.const 0x9b) $SCALL) ;; [6.1.2210](https://forth-standard.org/standard/core/SIGN) (func $SIGN (param $tos i32) (result i32) @@ -1716,8 +1812,8 @@ (i32.store8 (local.tee $npo (i32.sub (global.get $po) (i32.const 1))) (i32.const 0x2d (; = '-' ;))) (global.set $po (local.get $npo)))) (local.get $btos)) - (data (i32.const 0x2083c) "\2c\08\02\00" "\04" "SIGN " "\97\00\00\00") - (elem (i32.const 0x97) $SIGN) + (data (i32.const 0x2088c) "\7c\08\02\00" "\04" "SIGN " "\9c\00\00\00") + (elem (i32.const 0x9c) $SIGN) ;; [6.1.2214](https://forth-standard.org/standard/core/SMDivREM) ;; @@ -1738,29 +1834,29 @@ (i32.wrap_i64 (i64.div_s (local.get $n1) (local.get $n2)))) (local.get $btos)) - (data (i32.const 0x2084c) "\3c\08\02\00" "\06" "SM/REM " "\98\00\00\00") - (elem (i32.const 0x98) $SM/REM) + (data (i32.const 0x2089c) "\8c\08\02\00" "\06" "SM/REM " "\9d\00\00\00") + (elem (i32.const 0x9d) $SM/REM) ;; [6.1.2216](https://forth-standard.org/standard/core/SOURCE) (func $SOURCE (param $tos i32) (result i32) (local.get $tos) (call $push (global.get $inputBufferBase)) (call $push (global.get $inputBufferSize))) - (data (i32.const 0x2085c) "\4c\08\02\00" "\06" "SOURCE " "\99\00\00\00") - (elem (i32.const 0x99) $SOURCE) + (data (i32.const 0x208ac) "\9c\08\02\00" "\06" "SOURCE " "\9e\00\00\00") + (elem (i32.const 0x9e) $SOURCE) ;; [6.2.2218](https://forth-standard.org/standard/core/SOURCE-ID) (func $SOURCE-ID (param $tos i32) (result i32) (call $push (local.get $tos) (global.get $sourceID))) - (data (i32.const 0x2086c) "\5c\08\02\00" "\09" "SOURCE-ID " "\9a\00\00\00") - (elem (i32.const 0x9a) $SOURCE-ID) + (data (i32.const 0x208bc) "\ac\08\02\00" "\09" "SOURCE-ID " "\9f\00\00\00") + (elem (i32.const 0x9f) $SOURCE-ID) ;; [6.1.2220](https://forth-standard.org/standard/core/SPACE) (func $SPACE (param $tos i32) (result i32) (local.get $tos) (call $BL) (call $EMIT)) - (data (i32.const 0x20880) "\6c\08\02\00" "\05" "SPACE " "\9b\00\00\00") - (elem (i32.const 0x9b) $SPACE) + (data (i32.const 0x208d0) "\bc\08\02\00" "\05" "SPACE " "\a0\00\00\00") + (elem (i32.const 0xa0) $SPACE) ;; [6.1.2230](https://forth-standard.org/standard/core/SPACES) (func $SPACES (param $tos i32) (result i32) @@ -1773,11 +1869,11 @@ (call $SPACE) (local.set $i (i32.sub (local.get $i) (i32.const 1))) (br $loop)))) - (data (i32.const 0x20890) "\80\08\02\00" "\06" "SPACES " "\9c\00\00\00") - (elem (i32.const 0x9c) $SPACES) + (data (i32.const 0x208e0) "\d0\08\02\00" "\06" "SPACES " "\a1\00\00\00") + (elem (i32.const 0xa1) $SPACES) ;; [6.1.2250](https://forth-standard.org/standard/core/STATE) - (data (i32.const 0x208a0) "\90\08\02\00" "\45" (; F_DATA ;) "STATE " "\03\00\00\00" (; = pack(PUSH_DATA_ADDRESS_INDEX) ;) "\00\00\00\00" (; = pack(0) ;)) + (data (i32.const 0x208f0) "\e0\08\02\00" "\45" (; F_DATA ;) "STATE " "\03\00\00\00" (; = pack(PUSH_DATA_ADDRESS_INDEX) ;) "\00\00\00\00" (; = pack(0) ;)) ;; [6.1.2260](https://forth-standard.org/standard/core/SWAP) (func $SWAP (param $tos i32) (result i32) @@ -1789,16 +1885,16 @@ (i32.load (local.tee $btos (i32.sub (local.get $tos) (i32.const 4))))) (i32.store (local.get $btos) (local.get $tmp)) (local.get $tos)) - (data (i32.const 0x208b4) "\a0\08\02\00" "\04" "SWAP " "\9d\00\00\00") - (elem (i32.const 0x9d) $SWAP) + (data (i32.const 0x20904) "\f0\08\02\00" "\04" "SWAP " "\a2\00\00\00") + (elem (i32.const 0xa2) $SWAP) ;; [6.1.2270](https://forth-standard.org/standard/core/THEN) (func $THEN (param $tos i32) (result i32) (local.get $tos) (call $ensureCompiling) (call $compileThen)) - (data (i32.const 0x208c4) "\b4\08\02\00" "\84" (; F_IMMEDIATE ;) "THEN " "\9e\00\00\00") - (elem (i32.const 0x9e) $THEN) + (data (i32.const 0x20914) "\04\09\02\00" "\84" (; F_IMMEDIATE ;) "THEN " "\a3\00\00\00") + (elem (i32.const 0xa3) $THEN) ;; [6.2.2295](https://forth-standard.org/standard/core/TO) (func $TO (param $tos i32) (result i32) @@ -1809,14 +1905,14 @@ (i32.store (i32.add (call $body (local.get $xt)) (i32.const 4)) (i32.load (local.tee $btos (i32.sub (local.get $tos) (i32.const 4))))) (local.get $btos)) - (data (i32.const 0x208d4) "\c4\08\02\00" "\02" "TO " "\9f\00\00\00") - (elem (i32.const 0x9f) $TO) + (data (i32.const 0x20924) "\14\09\02\00" "\02" "TO " "\a4\00\00\00") + (elem (i32.const 0xa4) $TO) ;; [6.2.2298](https://forth-standard.org/standard/core/TRUE) (func $TRUE (param $tos i32) (result i32) (call $push (local.get $tos) (i32.const 0xffffffff))) - (data (i32.const 0x208e0) "\d4\08\02\00" "\04" "TRUE " "\a0\00\00\00") - (elem (i32.const 0xa0) $TRUE) + (data (i32.const 0x20930) "\24\09\02\00" "\04" "TRUE " "\a5\00\00\00") + (elem (i32.const 0xa5) $TRUE) ;; [6.2.2300](https://forth-standard.org/standard/core/TUCK) (func $TUCK (param $tos i32) (result i32) @@ -1827,8 +1923,8 @@ (i32.load (i32.sub (local.get $tos) (i32.const 8)))) (i32.store (i32.sub (local.get $tos) (i32.const 8)) (local.get $v)) (i32.add (local.get $tos) (i32.const 4))) - (data (i32.const 0x208f0) "\e0\08\02\00" "\04" "TUCK " "\a1\00\00\00") - (elem (i32.const 0xa1) $TUCK) + (data (i32.const 0x20940) "\30\09\02\00" "\04" "TUCK " "\a6\00\00\00") + (elem (i32.const 0xa6) $TUCK) ;; [6.1.2310](https://forth-standard.org/standard/core/TYPE) (func $TYPE (param $tos i32) (result i32) @@ -1838,16 +1934,16 @@ (local.set $len (call $pop)) (local.set $p (call $pop)) (call $type (local.get $p) (local.get $len))) - (data (i32.const 0x20900) "\f0\08\02\00" "\04" "TYPE " "\a2\00\00\00") - (elem (i32.const 0xa2) $TYPE) + (data (i32.const 0x20950) "\40\09\02\00" "\04" "TYPE " "\a7\00\00\00") + (elem (i32.const 0xa7) $TYPE) ;; [6.1.2320](https://forth-standard.org/standard/core/Ud) (func $U. (param $tos i32) (result i32) (local.get $tos) - (call $U._ (call $pop) (i32.load (i32.const 0x203bc (; = body(BASE) ;)))) + (call $U._ (call $pop) (i32.load (i32.const 0x203d0 (; = body(BASE) ;)))) (call $shell_emit (i32.const 0x20))) - (data (i32.const 0x20910) "\00\09\02\00" "\02" "U. " "\a3\00\00\00") - (elem (i32.const 0xa3) $U.) + (data (i32.const 0x20960) "\50\09\02\00" "\02" "U. " "\a8\00\00\00") + (elem (i32.const 0xa8) $U.) ;; [6.1.2340](https://forth-standard.org/standard/core/Uless) (func $U< (param $tos i32) (result i32) @@ -1858,8 +1954,8 @@ (then (i32.store (local.get $bbtos) (i32.const -1))) (else (i32.store (local.get $bbtos) (i32.const 0)))) (local.get $btos)) - (data (i32.const 0x2091c) "\10\09\02\00" "\02" "U< " "\a4\00\00\00") - (elem (i32.const 0xa4) $U<) + (data (i32.const 0x2096c) "\60\09\02\00" "\02" "U< " "\a9\00\00\00") + (elem (i32.const 0xa9) $U<) ;; [6.2.2350](https://forth-standard.org/standard/core/Umore) (func $U> (param $tos i32) (result i32) @@ -1870,8 +1966,8 @@ (then (i32.store (local.get $bbtos) (i32.const -1))) (else (i32.store (local.get $bbtos) (i32.const 0)))) (local.get $btos)) - (data (i32.const 0x20928) "\1c\09\02\00" "\02" "U> " "\a5\00\00\00") - (elem (i32.const 0xa5) $U>) + (data (i32.const 0x20978) "\6c\09\02\00" "\02" "U> " "\aa\00\00\00") + (elem (i32.const 0xaa) $U>) ;; [6.1.2360](https://forth-standard.org/standard/core/UMTimes) (func $UM* (param $tos i32) (result i32) @@ -1881,8 +1977,8 @@ (i64.extend_i32_u (i32.load (i32.sub (local.get $tos) (i32.const 4)))))) (local.get $tos)) - (data (i32.const 0x20934) "\28\09\02\00" "\03" "UM*" "\a6\00\00\00") - (elem (i32.const 0xa6) $UM*) + (data (i32.const 0x20984) "\78\09\02\00" "\03" "UM*" "\ab\00\00\00") + (elem (i32.const 0xab) $UM*) ;; [6.1.2370](https://forth-standard.org/standard/core/UMDivMOD) (func $UM/MOD (param $tos i32) (result i32) @@ -1901,50 +1997,50 @@ (i32.wrap_i64 (i64.div_u (local.get $n1) (local.get $n2)))) (local.get $btos)) - (data (i32.const 0x20940) "\34\09\02\00" "\06" "UM/MOD " "\a7\00\00\00") - (elem (i32.const 0xa7) $UM/MOD) + (data (i32.const 0x20990) "\84\09\02\00" "\06" "UM/MOD " "\ac\00\00\00") + (elem (i32.const 0xac) $UM/MOD) ;; [6.1.2380](https://forth-standard.org/standard/core/UNLOOP) (func $UNLOOP (param $tos i32) (result i32) (local.get $tos) (call $ensureCompiling) (call $compileCall (i32.const 0) (i32.const 0x9 (; = END_DO_INDEX ;)))) - (data (i32.const 0x20950) "\40\09\02\00" "\86" (; F_IMMEDIATE ;) "UNLOOP " "\a8\00\00\00") - (elem (i32.const 0xa8) $UNLOOP) + (data (i32.const 0x209a0) "\90\09\02\00" "\86" (; F_IMMEDIATE ;) "UNLOOP " "\ad\00\00\00") + (elem (i32.const 0xad) $UNLOOP) ;; [6.1.2390](https://forth-standard.org/standard/core/UNTIL) (func $UNTIL (param $tos i32) (result i32) (local.get $tos) (call $ensureCompiling) (call $compileUntil)) - (data (i32.const 0x20960) "\50\09\02\00" "\85" (; F_IMMEDIATE ;) "UNTIL " "\a9\00\00\00") - (elem (i32.const 0xa9) $UNTIL) + (data (i32.const 0x209b0) "\a0\09\02\00" "\85" (; F_IMMEDIATE ;) "UNTIL " "\ae\00\00\00") + (elem (i32.const 0xae) $UNTIL) ;; [6.2.2395](https://forth-standard.org/standard/core/UNUSED) (func $UNUSED (param $tos i32) (result i32) (local.get $tos) (call $push (i32.sub (i32.const 0x6400000 (; = MEMORY_SIZE ;)) (global.get $here)))) - (data (i32.const 0x20970) "\60\09\02\00" "\06" "UNUSED " "\aa\00\00\00") - (elem (i32.const 0xaa) $UNUSED) + (data (i32.const 0x209c0) "\b0\09\02\00" "\06" "UNUSED " "\af\00\00\00") + (elem (i32.const 0xaf) $UNUSED) ;; [6.2.2405](https://forth-standard.org/standard/core/VALUE) - (data (i32.const 0x20980) "\70\09\02\00" "\05" "VALUE " "\58\00\00\00" (; = pack(index("CONSTANT")) ;)) + (data (i32.const 0x209d0) "\c0\09\02\00" "\05" "VALUE " "\59\00\00\00" (; = pack(index("CONSTANT")) ;)) ;; [6.1.2410](https://forth-standard.org/standard/core/VARIABLE) (func $VARIABLE (param $tos i32) (result i32) (local.get $tos) (call $CREATE) (global.set $here (i32.add (global.get $here) (i32.const 4)))) - (data (i32.const 0x20990) "\80\09\02\00" "\08" "VARIABLE " "\ab\00\00\00") - (elem (i32.const 0xab) $VARIABLE) + (data (i32.const 0x209e0) "\d0\09\02\00" "\08" "VARIABLE " "\b0\00\00\00") + (elem (i32.const 0xb0) $VARIABLE) ;; [6.1.2430](https://forth-standard.org/standard/core/WHILE) (func $WHILE (param $tos i32) (result i32) (local.get $tos) (call $ensureCompiling) (call $compileWhile)) - (data (i32.const 0x209a4) "\90\09\02\00" "\85" (; F_IMMEDIATE ;) "WHILE " "\ac\00\00\00") - (elem (i32.const 0xac) $WHILE) + (data (i32.const 0x209f4) "\e0\09\02\00" "\85" (; F_IMMEDIATE ;) "WHILE " "\b1\00\00\00") + (elem (i32.const 0xb1) $WHILE) ;; [6.2.2440](https://forth-standard.org/standard/core/WITHIN) (func $WITHIN (param $tos i32) (result i32) @@ -1965,8 +2061,8 @@ (else (i32.const 0)))) (local.get $bbtos)) - (data (i32.const 0x209b4) "\a4\09\02\00" "\06" "WITHIN " "\ad\00\00\00") - (elem (i32.const 0xad) $WITHIN) + (data (i32.const 0x20a04) "\f4\09\02\00" "\06" "WITHIN " "\b2\00\00\00") + (elem (i32.const 0xb2) $WITHIN) ;; [6.1.2450](https://forth-standard.org/standard/core/WORD) (func $WORD (param $tos i32) (result i32) @@ -1986,8 +2082,8 @@ (local.get $len)) (i32.store8 (local.get $wordBase) (local.get $len)) (call $push (local.get $wordBase))) - (data (i32.const 0x209c4) "\b4\09\02\00" "\04" "WORD " "\ae\00\00\00") - (elem (i32.const 0xae) $WORD) + (data (i32.const 0x20a14) "\04\0a\02\00" "\04" "WORD " "\b3\00\00\00") + (elem (i32.const 0xb3) $WORD) ;; 15.6.1.2465 (func $WORDS (param $tos i32) (result i32) @@ -2008,8 +2104,8 @@ (local.set $entryP (i32.load (local.get $entryP))) (br_if $loop (local.get $entryP))) (local.get $tos)) - (data (i32.const 0x209d4) "\c4\09\02\00" "\05" "WORDS " "\af\00\00\00") - (elem (i32.const 0xaf) $WORDS) + (data (i32.const 0x20a24) "\14\0a\02\00" "\05" "WORDS " "\b4\00\00\00") + (elem (i32.const 0xb4) $WORDS) ;; [6.1.2490](https://forth-standard.org/standard/core/XOR) (func $XOR (param $tos i32) (result i32) @@ -2019,16 +2115,16 @@ (i32.xor (i32.load (local.tee $btos (i32.sub (local.get $tos) (i32.const 4)))) (i32.load (local.get $bbtos)))) (local.get $btos)) - (data (i32.const 0x209e4) "\d4\09\02\00" "\03" "XOR" "\b0\00\00\00") - (elem (i32.const 0xb0) $XOR) + (data (i32.const 0x20a34) "\24\0a\02\00" "\03" "XOR" "\b5\00\00\00") + (elem (i32.const 0xb5) $XOR) ;; [6.1.2500](https://forth-standard.org/standard/core/Bracket) (func $left-bracket (param $tos i32) (result i32) (local.get $tos) (call $ensureCompiling) - (i32.store (i32.const 0x208b0 (; = body(STATE) ;)) (i32.const 0))) - (data (i32.const 0x209f0) "\e4\09\02\00" "\81" (; F_IMMEDIATE ;) "[ " "\b1\00\00\00") - (elem (i32.const 0xb1) $left-bracket) + (i32.store (i32.const 0x20900 (; = body(STATE) ;)) (i32.const 0))) + (data (i32.const 0x20a40) "\34\0a\02\00" "\81" (; F_IMMEDIATE ;) "[ " "\b6\00\00\00") + (elem (i32.const 0xb6) $left-bracket) ;; [6.1.2510](https://forth-standard.org/standard/core/BracketTick) (func $bracket-tick (param $tos i32) (result i32) @@ -2036,8 +2132,8 @@ (call $ensureCompiling) (call $') (call $compilePushConst (call $pop))) - (data (i32.const 0x209fc) "\f0\09\02\00" "\83" (; F_IMMEDIATE ;) "[']" "\b2\00\00\00") - (elem (i32.const 0xb2) $bracket-tick) + (data (i32.const 0x20a4c) "\40\0a\02\00" "\83" (; F_IMMEDIATE ;) "[']" "\b7\00\00\00") + (elem (i32.const 0xb7) $bracket-tick) ;; [6.1.2520](https://forth-standard.org/standard/core/BracketCHAR) (func $bracket-char (param $tos i32) (result i32) @@ -2045,22 +2141,22 @@ (call $ensureCompiling) (call $CHAR) (call $compilePushConst (call $pop))) - (data (i32.const 0x20a08) "\fc\09\02\00" "\86" (; F_IMMEDIATE ;) "[CHAR] " "\b3\00\00\00") - (elem (i32.const 0xb3) $bracket-char) + (data (i32.const 0x20a58) "\4c\0a\02\00" "\86" (; F_IMMEDIATE ;) "[CHAR] " "\b8\00\00\00") + (elem (i32.const 0xb8) $bracket-char) ;; [6.2.2535](https://forth-standard.org/standard/core/bs) (func $\ (param $tos i32) (result i32) (drop (drop (call $parse (i32.const 0x0a (; '\n' ;))))) (local.get $tos)) - (data (i32.const 0x20a18) "\08\0a\02\00" "\81" (; F_IMMEDIATE ;) "\5c " "\b4\00\00\00") - (elem (i32.const 0xb4) $\) + (data (i32.const 0x20a68) "\58\0a\02\00" "\81" (; F_IMMEDIATE ;) "\5c " "\b9\00\00\00") + (elem (i32.const 0xb9) $\) ;; [6.1.2540](https://forth-standard.org/standard/right-bracket) (func $right-bracket (param $tos i32) (result i32) - (i32.store (i32.const 0x208b0 (; = body(STATE) ;)) (i32.const 1)) + (i32.store (i32.const 0x20900 (; = body(STATE) ;)) (i32.const 1)) (local.get $tos)) - (data (i32.const 0x20a24) "\18\0a\02\00" "\01" "] " "\b5\00\00\00") - (elem (i32.const 0xb5) $right-bracket) + (data (i32.const 0x20a74) "\68\0a\02\00" "\01" "] " "\ba\00\00\00") + (elem (i32.const 0xba) $right-bracket) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -2101,7 +2197,7 @@ ;; Show prompt (if (i32.eqz (local.get $silent)) (then - (if (i32.ge_s (i32.load (i32.const 0x208b0 (; = body(STATE) ;))) (i32.const 0)) + (if (i32.ge_s (i32.load (i32.const 0x20900 (; = body(STATE) ;))) (i32.const 0)) (then ;; Write ok (call $shell_emit (i32.const 111)) @@ -2155,7 +2251,7 @@ ;; It's a number. Are we compiling? (then (local.set $number) - (if (i32.load (i32.const 0x208b0 (; = body(STATE) ;))) + (if (i32.load (i32.const 0x20900 (; = body(STATE) ;))) (then ;; We're compiling. Pop it off the stack and ;; add it to the compiled list @@ -2171,7 +2267,7 @@ ;; Name found in the dictionary. ;; Are we compiling and is the word non-immediate? (if (i32.and - (i32.load (i32.const 0x208b0 (; = body(STATE) ;))) + (i32.load (i32.const 0x20900 (; = body(STATE) ;))) (i32.ne (local.get $FINDResult) (i32.const 1))) (then ;; We're compiling a non-immediate. @@ -2210,7 +2306,7 @@ (global.set $tos (local.get $tos)) (global.set $tors (i32.const 0x2000 (; = RETURN_STACK_BASE ;))) (global.set $sourceID (i32.const 0)) - (i32.store (i32.const 0x208b0 (; = body(STATE) ;)) (i32.const 0)) + (i32.store (i32.const 0x20900 (; = body(STATE) ;)) (i32.const 0)) (unreachable)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -2231,9 +2327,9 @@ (global $sourceID (mut i32) (i32.const 0)) ;; Dictionary pointers - (global $latest (mut i32) (i32.const 0x20a24)) - (global $here (mut i32) (i32.const 0x20a30)) - (global $nextTableIndex (mut i32) (i32.const 0xb6)) + (global $latest (mut i32) (i32.const 0x20a74)) + (global $here (mut i32) (i32.const 0x20a80)) + (global $nextTableIndex (mut i32) (i32.const 0xbb)) ;; Pictured output pointer (global $po (mut i32) (i32.const -1)) @@ -2679,6 +2775,10 @@ (local.get $tos)) (elem (i32.const 0x7 (; = RESET_MARKER_INDEX ;)) $resetMarker) + (func $executeDefer (param $tos i32) (param $dp i32) (result i32) + (call $execute (local.get $tos) (i32.load (local.get $dp)))) + (elem (i32.const 0x8 (; = EXECUTE_DEFER_INDEX ;)) $executeDefer) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Helper functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -2761,7 +2861,7 @@ (func $ensureCompiling (param $tos i32) (result i32) (local.get $tos) - (if (param i32) (result i32) (i32.eqz (i32.load (i32.const 0x208b0 (; = body(STATE) ;)))) + (if (param i32) (result i32) (i32.eqz (i32.load (i32.const 0x20900 (; = body(STATE) ;)))) (call $fail (i32.const 0x2002e (; = str("word not supported in interpret mode") ;))))) ;; LEB128 with fixed 4 bytes (with padding bytes) @@ -2905,7 +3005,7 @@ (local $n i32) (local.set $p (local.get $addr)) (local.set $end (i32.add (local.get $p) (local.get $length))) - (local.set $base (i32.load (i32.const 0x203bc (; = body(BASE) ;)))) + (local.set $base (i32.load (i32.const 0x203d0 (; = body(BASE) ;)))) ;; Read first character (if (i32.eq (local.tee $char (i32.load8_u (local.get $p))) (i32.const 0x2d (; = '-' ;))) diff --git a/src/web/tests/forth2012-test-suite/coreexttest.fth b/src/web/tests/forth2012-test-suite/coreexttest.fth index 03bf44c..bd4650e 100644 --- a/src/web/tests/forth2012-test-suite/coreexttest.fth +++ b/src/web/tests/forth2012-test-suite/coreexttest.fth @@ -657,39 +657,39 @@ T{ PARSE-NAME-TEST abcde abcde T{ PARSE-NAME-TEST abcde abcde -> TRUE }T \ Leading and trailing spaces -\ \ ----------------------------------------------------------------------------- -\ TESTING DEFER DEFER@ DEFER! IS ACTION-OF (Forth 2012) -\ \ Adapted from the Forth 200X RfD tests +\ ----------------------------------------------------------------------------- +TESTING DEFER DEFER@ DEFER! IS ACTION-OF (Forth 2012) +\ Adapted from the Forth 200X RfD tests -\ T{ DEFER DEFER1 -> }T -\ T{ : MY-DEFER DEFER ; -> }T -\ T{ : IS-DEFER1 IS DEFER1 ; -> }T -\ T{ : ACTION-DEFER1 ACTION-OF DEFER1 ; -> }T -\ T{ : DEF! DEFER! ; -> }T -\ T{ : DEF@ DEFER@ ; -> }T +T{ DEFER DEFER1 -> }T +T{ : MY-DEFER DEFER ; -> }T +T{ : IS-DEFER1 IS DEFER1 ; -> }T +T{ : ACTION-DEFER1 ACTION-OF DEFER1 ; -> }T +T{ : DEF! DEFER! ; -> }T +T{ : DEF@ DEFER@ ; -> }T -\ T{ ' * ' DEFER1 DEFER! -> }T -\ T{ 2 3 DEFER1 -> 6 }T -\ T{ ' DEFER1 DEFER@ -> ' * }T -\ T{ ' DEFER1 DEF@ -> ' * }T -\ T{ ACTION-OF DEFER1 -> ' * }T -\ T{ ACTION-DEFER1 -> ' * }T -\ T{ ' + IS DEFER1 -> }T -\ T{ 1 2 DEFER1 -> 3 }T -\ T{ ' DEFER1 DEFER@ -> ' + }T -\ T{ ' DEFER1 DEF@ -> ' + }T -\ T{ ACTION-OF DEFER1 -> ' + }T -\ T{ ACTION-DEFER1 -> ' + }T -\ T{ ' - IS-DEFER1 -> }T -\ T{ 1 2 DEFER1 -> -1 }T -\ T{ ' DEFER1 DEFER@ -> ' - }T -\ T{ ' DEFER1 DEF@ -> ' - }T -\ T{ ACTION-OF DEFER1 -> ' - }T -\ T{ ACTION-DEFER1 -> ' - }T +T{ ' * ' DEFER1 DEFER! -> }T +T{ 2 3 DEFER1 -> 6 }T +T{ ' DEFER1 DEFER@ -> ' * }T +T{ ' DEFER1 DEF@ -> ' * }T +T{ ACTION-OF DEFER1 -> ' * }T +T{ ACTION-DEFER1 -> ' * }T +T{ ' + IS DEFER1 -> }T +T{ 1 2 DEFER1 -> 3 }T +T{ ' DEFER1 DEFER@ -> ' + }T +T{ ' DEFER1 DEF@ -> ' + }T +T{ ACTION-OF DEFER1 -> ' + }T +T{ ACTION-DEFER1 -> ' + }T +T{ ' - IS-DEFER1 -> }T +T{ 1 2 DEFER1 -> -1 }T +T{ ' DEFER1 DEFER@ -> ' - }T +T{ ' DEFER1 DEF@ -> ' - }T +T{ ACTION-OF DEFER1 -> ' - }T +T{ ACTION-DEFER1 -> ' - }T -\ T{ MY-DEFER DEFER2 -> }T -\ T{ ' DUP IS DEFER2 -> }T -\ T{ 1 DEFER2 -> 1 1 }T +T{ MY-DEFER DEFER2 -> }T +T{ ' DUP IS DEFER2 -> }T +T{ 1 DEFER2 -> 1 1 }T \ ----------------------------------------------------------------------------- TESTING HOLDS (Forth 2012) diff --git a/src/web/tests/suite.js b/src/web/tests/suite.js index 063977d..ec96754 100644 --- a/src/web/tests/suite.js +++ b/src/web/tests/suite.js @@ -1578,6 +1578,25 @@ function loadTests() { }); }); + describe("DEFER", () => { + it("should work", () => { + run("DEFER DEFER1"); + run("' * ' DEFER1 DEFER!"); + run("2 3 DEFER1"); + expect(stackValues()).to.eql([6]); + }); + }); + + describe("IS", () => { + it("should work compiled", () => { + run("DEFER DEFER1"); + run(": IS-DEFER1 IS DEFER1 ;"); + run("' - IS-DEFER1"); + run("1 2 DEFER1"); + expect(stackValues()).to.eql([-1]); + }); + }); + describe("system", () => { it("should run sieve", () => { run(sieve);