From ffd0226fdb1079aee3de35c10f8e6ff1fc1ce690 Mon Sep 17 00:00:00 2001 From: Brad Nelson Date: Thu, 7 Nov 2024 19:00:33 -0800 Subject: [PATCH] Fix bug with 10 and 41. --- common/boot.fs | 2 +- common/comments.fs | 8 ++++---- common/forth_namespace_tests.fs | 2 -- common/tier1_opcodes.h | 2 -- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/common/boot.fs b/common/boot.fs index f93b33e..fd20bb6 100644 --- a/common/boot.fs +++ b/common/boot.fs @@ -67,7 +67,7 @@ create NEXT ' donext @ ' next ! : next -1 nest-depth +! ['] next , , ; immed ; ( Define a recognizer stack. ) -create RECSTACK 0 , 10 cells allot +create RECSTACK 0 , bl 2/ ( 16 no numbers yet ) cells allot : +RECOGNIZER ( xt -- ) 1 RECSTACK +! RECSTACK dup @ cells + ! ; : -RECOGNIZER ( -- ) -1 RECSTACK +! ; : GET-RECOGNIZERS ( -- xtn..xt1 n ) diff --git a/common/comments.fs b/common/comments.fs index e85e5ef..94d9bf5 100644 --- a/common/comments.fs +++ b/common/comments.fs @@ -12,7 +12,7 @@ \ See the License for the specific language governing permissions and \ limitations under the License. -: ( 41 parse drop drop ; immediate -: \ 10 parse drop drop ; immediate -: #! 10 parse drop drop ; immediate ( shebang for scripts ) -( Now can do comments! ) +: ( bl nl + 1- parse drop drop ; immediate ( Now can do comments! ) +( bl=32 nl=10 so nl+32-1=41, right paren ) +: \ nl parse drop drop ; immediate +: #! nl parse drop drop ; immediate ( shebang for scripts ) diff --git a/common/forth_namespace_tests.fs b/common/forth_namespace_tests.fs index 33eb44f..775e89e 100644 --- a/common/forth_namespace_tests.fs +++ b/common/forth_namespace_tests.fs @@ -162,8 +162,6 @@ e: check-tier1-opcodes out: 0 out: 1 out: -1 - out: 10 - out: 41 out: nip out: rdrop out: */ diff --git a/common/tier1_opcodes.h b/common/tier1_opcodes.h index b83833c..466ecbd 100644 --- a/common/tier1_opcodes.h +++ b/common/tier1_opcodes.h @@ -16,8 +16,6 @@ X("0", ZERO, PUSH 0) \ X("1", ONE, PUSH 1) \ X("-1", NEGATIVEONE, PUSH -1) \ - X("10", TEN, PUSH 10) \ - X("41", FOURTYONE, PUSH 41) \ Y(nip, NIP) \ Y(rdrop, --rp) \ XV(forth, "*/", STARSLASH, SSMOD_FUNC; NIP) \