From 63b0c745abe618f5b285a1b67ad9c6f1e5d59fdd Mon Sep 17 00:00:00 2001 From: Jesse McDonald Date: Tue, 27 Oct 2020 21:52:24 -0500 Subject: [PATCH] rename WORD to PARSE-NAME (from FORTH 2012) which is a better match for the interface --- jumpforth.S | 16 ++++++++-------- startup.4th | 18 +++++++++--------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/jumpforth.S b/jumpforth.S index 42acc3f..a172517 100644 --- a/jumpforth.S +++ b/jumpforth.S @@ -1308,8 +1308,8 @@ defword SKIP_SPACE,"SKIP-SPACE" 1: .int DROP 2: .int EXIT -/* ( "ccc" -- c-addr u ) */ -defword WORD +/* ( "ccc" -- c-addr u ) */ +defword PARSE_NAME,"PARSE-NAME" .int SKIP_SPACE .int PARSE_AREA,DROP,LIT,1 .int NEXT_CHAR,DROP @@ -1370,7 +1370,7 @@ defword INTERPRET litstring "Tried to interpret a string literal\n" .int TYPE,BAILOUT /* ELSE */ -1: .int WORD,TWODUP,PARSENUMBER,ZBRANCH,(3f - .) +1: .int PARSE_NAME,TWODUP,PARSENUMBER,ZBRANCH,(3f - .) .int STATE,FETCH,TWONIP,ZBRANCH,(2f - .) .int LIT,LIT,COMMA,COMMA 2: .int EXIT @@ -1394,11 +1394,11 @@ defword QUIT defword LATEST .int CURRENT,FETCH,FETCH,EXIT -/* CREATE depends on bootstrap ALIGN, COMMA, LATEST, WORD, ALLOT, >FLAGS, and >DFA */ +/* CREATE depends on bootstrap ALIGN, COMMA, LATEST, PARSE_NAME, ALLOT, >FLAGS, and >DFA */ defword CREATE .int ALIGN,HERE .int LIT,DODATA,COMMA,LIT,0,COMMA,LATEST,COMMA - .int WORD,DUP,COMMABYTE,HERE,SWAP,DUP,ALLOT,CMOVE + .int PARSE_NAME,DUP,COMMABYTE,HERE,SWAP,DUP,ALLOT,CMOVE .int ALIGN,HERE,OVER,TDFA,STORE .int CURRENT,FETCH,STORE,EXIT @@ -1451,7 +1451,7 @@ defword DEFER .int CREATE,LIT,BAILOUT,LATEST,DEFERSTORE,EXIT defword QUOTE,"'" - .int WORD,FIND_OR_BAILOUT,DROP,EXIT + .int PARSE_NAME,FIND_OR_BAILOUT,DROP,EXIT defword LITERAL,,F_IMMED .int LIT,LIT,COMMA,COMMA,EXIT @@ -1460,13 +1460,13 @@ defword COMPILE_QUOTE,"[']",F_IMMED .int QUOTE,LITERAL,EXIT defword CHAR - .int WORD,DROP,FETCHBYTE,EXIT + .int PARSE_NAME,DROP,FETCHBYTE,EXIT defword COMPILE_CHAR,"[CHAR]",F_IMMED .int CHAR,LITERAL,EXIT defword POSTPONE,,F_IMMED - .int WORD,FIND_OR_BAILOUT,ZGT,ZBRANCH,(0f - .) + .int PARSE_NAME,FIND_OR_BAILOUT,ZGT,ZBRANCH,(0f - .) .int LITERAL /* this would compile bootstrap COMMA into the definition */ /* .int LITERAL,LIT,COMMA,COMMA,EXIT */ diff --git a/startup.4th b/startup.4th index 30b4049..e382bd1 100644 --- a/startup.4th +++ b/startup.4th @@ -1173,7 +1173,7 @@ DEFER REFILL \ Skip whitespace; read and return the next word delimited by whitespace \ The delimiting whitespace character is left in the parse area -: WORD ( "ccc" -- c-addr u ) +: PARSE-NAME ( "ccc" -- c-addr u ) BEGIN SKIP-SPACES PARSE-EMPTY? @@ -1209,7 +1209,7 @@ DEFER REFILL >>FORTH : CREATE ( "ccc" -- ) - WORD (CREATE) ; + PARSE-NAME (CREATE) ; \ Append " (DOES) EXIT" to the current definition \ where is the next address after the "EXIT" as a literal number @@ -1219,7 +1219,7 @@ DEFER REFILL \ Debugging aid; shows a label and the contents of the stacks at runtime : (MARK) "-- " TYPE TYPE " --\n" TYPE .S R> .RS >R ; -: MARK IMMEDIATE WORD POSTPONE SLITERAL POSTPONE (MARK) ; +: MARK IMMEDIATE PARSE-NAME POSTPONE SLITERAL POSTPONE (MARK) ; ' (MARK) (HIDE) \ Define a threaded FORTH word @@ -1400,7 +1400,7 @@ DEFER REFILL : [IF] IMMEDIATE 0= IF 0 BEGIN - WORD 2>R + PARSE-NAME 2>R 2R@ "[IF]" COMPARE 0= IF 1+ ELSE 2R@ "[THEN]" COMPARE 0= OR-ELSE 2R@ "[ELSE]" COMPARE 0= THEN IF @@ -1415,7 +1415,7 @@ DEFER REFILL \ Skips over nested [IF] … [THEN] or [IF] … [ELSE] … [THEN] structures : [ELSE] IMMEDIATE 0 BEGIN - WORD 2>R + PARSE-NAME 2>R 2R@ "[IF]" COMPARE 0= IF 1+ ELSE 2R@ "[THEN]" COMPARE 0= IF @@ -1430,7 +1430,7 @@ DEFER REFILL \ Read the next word and return the first character : CHAR ( "name" -- c ) - WORD DROP C@ ; + PARSE-NAME DROP C@ ; \ Like CHAR but generates a literal at compile-time. : [CHAR] ( Compilation: "ccc" -- ) ( Runtime: -- c ) IMMEDIATE @@ -1808,7 +1808,7 @@ BOOTSTRAP-GET-ORDER SET-ORDER \ Read a word from the input (during runtime) and return its execution token \ Aborts if the word is not found in the current (runtime) search order list -: ' ( "ccc" -- xt ) WORD FIND-OR-THROW DROP ; +: ' ( "ccc" -- xt ) PARSE-NAME FIND-OR-THROW DROP ; \ Like ' but generates a literal at compile-time. : ['] ( Compilation: "ccc" -- ) ( Runtime: -- xt ) IMMEDIATE @@ -1816,7 +1816,7 @@ BOOTSTRAP-GET-ORDER SET-ORDER \ Read a word and append its compilation semantics to the current definition. : POSTPONE ( "name" -- ) IMMEDIATE - WORD FIND-OR-THROW 0< IF + PARSE-NAME FIND-OR-THROW 0< IF COMPILE, ELSE POSTPONE LITERAL @@ -1971,7 +1971,7 @@ NULL 0 STRING-BUFFER 2! HERE SWAP DUP ALLOT CMOVE ALIGN THEN ELSE - WORD + PARSE-NAME 2DUP PARSENUMBER IF STATE @ 2NIP IF POSTPONE LITERAL