PF11 -- Glossary By Language Category
Andrew Sterian
Padnos School of Engineering
Grand Valley State University
| Top-Level | Glossary | Compiler Design | Rationale
| Notes |
Version 1.0 |
| July 18, 2003 |
|
| Glossary by Language Category | Glossary by Word Name | Glossary by Source Location | Glossary by ANS Word Set |
The flags column may contain the letters I or D to indicate immediate or deferred words.
The source definition column is either of the form ID_XXXX to indicate an internal word with the given ID, or is the filename (minus the .ft extension) where the word is defined.
The ANS section column is either pforth to indicate the word is not an ANS standard word, or is the name of an ANS standard word set which describes the word.
The language category column describes the part of the Forth language that the word applies to (e.g., io, loops, math, etc.)
The description column provides a brief reference on the word.
These words perform primary stack manipulations.
| Word Name | Flags | Source Definition | ANS Section | Language Category | Description |
|---|---|---|---|---|---|
| 2>R | ID_2_TO_R | coreext | stack | ( x1 x2 -- ) (R: -- x1 x2 ) Move two cells from data stack to return stack | |
| 2DROP | core | core | stack | ( n1 n2 -- ) Drop 2 items | |
| 2DUP | core | core | stack | ( n1 n2 -- n1 n2 n1 n2) Duplicate 2 items | |
| 2OVER | core | core | stack | ( x1 x2 x3 x4 -- x1 x2 x3 x4 x1 x2 ) | |
| 2R> | ID_2_R_FROM | coreext | stack | ( -- x1 x2 ) (R: x1 x2 -- ) Move two cells from return stack to data stack | |
| 2R@ | ID_2_R_FETCH | coreext | stack | ( -- x1 x2 ) (R: x1 x2 -- x1 x2 ) Copy two cells from return stack to data stack | |
| 2SWAP | core | core | stack | ( x1 x2 x3 x4 -- x3 x4 x1 x2 ) | |
| >R | ID_TO_R | core | stack | ( x -- ) ( R: -- x ) Move top-of-stack to return stack | |
| ?DUP | ID_QDUP | core | stack | ( x -- 0 | x x ) Duplicate TOS if nonzero | |
| CS-PICK | progtools | stack | NOT IMPLEMENTED in pForth | ||
| CS-ROLL | progtools | stack | NOT IMPLEMENTED in pForth | ||
| DEPTH | ID_DEPTH | core | stack | ( -- n ) Number of items pushed on stack (prior to calling DEPTH) | |
| DROP | ID_DROP | core | stack | ( x -- ) Drops the top-of-stack | |
| DUP | ID_DUP | core | stack | ( x -- x x ) Duplicate top-of-stack | |
| NIP | core | coreext | stack | ( x1 x2 -- x2 ) Remove element above top-of-stack | |
| OVER | ID_OVER | core | stack | ( x1 x2 -- x1 x2 x1 ) | |
| PICK | ID_PICK | coreext | stack | ( xu...x1 x0 u -- xu...x1 x0 xu ) Copy STACK[u] to TOS | |
| R> | ID_R_FROM | core | stack | ( -- x ) (R: x -- ) Pop value from return stack and push to data stack | |
| R@ | ID_R_FETCH | core | stack | ( -- x ) (R: x -- x) Copy value from return stack and push to data stack | |
| RDROP | ID_R_DROP | pforth | stack | Drop from return stack | |
| ROLL | ID_ROLL | coreext | stack | ( xu xu-1 ... x0 u -- xu-1 ... x0 xu ). Size-u rotation of stack. | |
| ROT | ID_ROT | core | stack | ( x1 x2 x3 -- x2 x3 x1 ) Rotate top three stack elements | |
| RP! | ID_RP_STORE | pforth | stack | ( rp -- ) Make address the top of the return stack | |
| RP@ | ID_RP_FETCH | pforth | stack | ( -- rp ) Address of top of return stack prior to RP@ | |
| SP! | ID_SP_STORE | pforth | stack | ( sp -- ) Set address of top of stack | |
| SP@ | ID_SP_FETCH | pforth | stack | ( -- sp ) Get address of top of stack | |
| SWAP | ID_SWAP | core | stack | ( x1 x2 -- x2 x1 ) Swap two top stack elements | |
| TUCK | core | coreext | stack | ( x1 x2 -- x2 x1 x2 ) Copy top-of-stack as third element |
These words perform single-word (i.e., 1 cell) mathematical operations.
| Word Name | Flags | Source Definition | ANS Section | Language Category | Description |
|---|---|---|---|---|---|
| * | ID_TIMES | core | math | ( n1 n2 -- n1*n2 ) Signed multiplication | |
| */ | core | core | math | ( n1 n2 n3 -- n1*n2/n3 ) Product n1*n2 is 32-bit, result is 16-bit | |
| */MOD | core | core | math | ( n1 n2 n3 -- (n1*n2)%n3 n1*n2/n3 ) Product n1*n2 is 32-bit, quotent/remainder are 16-bit | |
| + | ID_PLUS | core | math | ( n1 n2 -- n1+n2 ) Signed addition | |
| - | ID_MINUS | core | math | ( n1 n2 -- n1-n2 ) Signed subtraction | |
| / | ID_DIVIDE | core | math | ( n1 n2 -- n1/n2 ) Signed division | |
| /MOD | core | core | math | ( n1 n2 -- n1%n2 n1/n2 ) Signed remainder and division | |
| 1+ | core | core | math | ( n -- n+1 ) | |
| 1- | core | core | math | ( n -- n-1 ) | |
| 2* | core | core | math | ( n -- n<<1 ) Arithmetic left shift | |
| 2/ | core | core | math | ( n -- n>>1 ) Arithmetic right shift | |
| ABS | core | core | math | ( x -- |x| ) Absolute value | |
| FM/MOD | ID_FM_S_MOD | core | math | ( d1 n1 -- d1%n1 d1/n1 ) Floored quotient and remainder (d1 is 32 bits) | |
| M* | ID_D_MTIMES | core | math | ( n1 n2 -- n1*n2 ) Signed multiplication, result is 32 bits | |
| MAX | ID_MAX | core | math | ( n1 n2 -- max(n1,n2) ) Maximum function | |
| MIN | ID_MIN | core | math | ( n1 n2 -- min(n1,n2) ) Minimum function | |
| MOD | core | core | math | ( n1 n2 -- n1%n2 ) Remainder function | |
| NEGATE | core | core | math | ( n -- -n ) Negative function | |
| SM/REM | ID_SM_S_REM | core | math | ( d1 n1 -- d1%n1 d1/n1 ) Signed symmetric quotient/remainder | |
| UM* | ID_D_UMTIMES | core | math | ( u1 u2 -- u1*u2 ) Compute 32-bit unsigned product | |
| UM/MOD | ID_D_UMSMOD | core | math | ( ud u1 -- ud%u1 ud/u1 ) Divide 32-bit ud by 16-bit u1 (unsigned) giving quotient/remainder | |
| WITHIN | coreext | coreext | math | ( x1 x2 x3 -- flag ) Sets flag true if x1 is between x2 and x3 |
These words compute logical and comparison functions.
| Word Name | Flags | Source Definition | ANS Section | Language Category | Description |
|---|---|---|---|---|---|
| 0< | ID_COMP_ZERO_LESSTHAN | core | logical | ( n -- flag ) Set flag if n<0 | |
| 0<> | ID_COMP_ZERO_NOT_EQUAL | coreext | logical | ( x -- flag ) Return true flag if x is not 0 | |
| 0= | ID_COMP_ZERO_EQUAL | core | logical | ( n -- flag ) Set flag if n=0 | |
| 0> | ID_COMP_ZERO_GREATERTHAN | coreext | logical | ( x -- flag ) Return true flag if x>0 (signed) | |
| < | ID_COMP_LESSTHAN | core | logical | ( n1 n2 -- flag ) Set flag if n1<n2 (signed) | |
| <= | core | pforth | logical | ( a b -- f ) True if a <= b (signed) | |
| <> | ID_COMP_NOT_EQUAL | coreext | logical | ( x1 x2 -- flag ) Return true flag if x1 != x2 | |
| = | ID_COMP_EQUAL | core | logical | ( n1 n2 -- flag ) Set flag if n1=n2 | |
| > | ID_COMP_GREATERTHAN | core | logical | ( n1 n2 -- flag ) Set flag if n1>n2 (signed) | |
| >= | core | pforth | logical | ( a b -- f ) True if a >= b (signed) | |
| AND | ID_AND | core | logical | ( x1 x2 -- x1&x2 ) Bitwise AND | |
| ARSHIFT | ID_ARSHIFT | pforth | logical | ( n a -- n>>a ) Arithmetic right shift | |
| INVERT | core | core | logical | ( n -- ~n ) One's complement | |
| LSHIFT | ID_LSHIFT | core | logical | ( n u -- n<<u ) Logical left shift | |
| NOT | core | pforth | logical | ( n -- !n ) Logical negation (equivalent to 0=) | |
| OR | ID_OR | core | logical | ( x1 x2 -- x1|x2 ) Logical OR | |
| RSHIFT | ID_RSHIFT | core | logical | ( x1 u -- x1>>u ) Logical right shift (NOTE: Not arithmetic right shift) | |
| U< | ID_COMP_U_LESSTHAN | core | logical | ( u1 u2 -- flag ) Sets flag if u1<u2 (unsigned) | |
| U> | ID_COMP_U_GREATERTHAN | coreext | logical | ( u1 u2 -- flag ) Sets flag true only if unsigned u1>u2 | |
| XOR | ID_XOR | core | logical | ( x1 x2 -- x1^x2 ) Exclusive-OR |
These words are core language components.
| Word Name | Flags | Source Definition | ANS Section | Language Category | Description |
|---|---|---|---|---|---|
| ' | ID_TICK | core | lang | ( "name" -- XT ) Push ExecToken for subsequent name | |
| ( | I | core | core | lang | Comment up to next ) |
| : | ID_COLON | core | lang | Define a new word | |
| ; | I | ID_SEMICOLON | core | lang | End a word definition |
| ABORT | D | core | core | lang | Abort current execution, clear stack, return to top level prompt |
| ABORT" | I | core | core | lang | ( x <message> -- ) If x is non-zero, print abort string and abort |
| BASE | ID_VAR_BASE | core | lang | ( -- addr ) Address of current number base variable | |
| CATCH | core | exception | lang | See documentation | |
| CHAR+ | core | core | lang | ( n -- n+1 ) Add size of a character | |
| CONSTANT | core | core | lang | ( n "name" -- ) Create a constant word with value n | |
| DEFER | ID_DEFER | pforth | lang | Create deferred word | |
| EVALUATE | core | core | lang | ( i*x addr u -- j*x ) Evaluate Forth words from given source buffer | |
| EXECUTE | ID_EXECUTE | core | lang | ( i*x XT -- j*x ) Execute the given token | |
| EXIT | ID_EXIT | core | lang | ( R: sys -- ) Return from the current word | |
| FALSE | core | coreext | lang | ( -- false ) Push false constant | |
| FIND | ID_FIND | core | lang | ( addr -- addr 0 | addr 1 | addr -1 ) Find counted string at addr in dictionary | |
| IMMEDIATE | core | core | lang | Make most recent word definition an immediate word | |
| IS | I | core | pforth | lang | Stores implementation in deferred word |
| LITERAL | I | ID_LITERAL | core | lang | ( x -- ) At run-time, push x on the stack |
| MARKER | coreext | coreext | lang | ( <name> -- ) Define a word that FORGET's itself when executed | |
| POSTPONE | I | core | core | lang | Compile next word into word definition |
| QUIT | D | core | core | lang | Interpreter loop (also ID_QUIT_P) |
| RECURSE | I | core | core | lang | Go to start of this word during execution |
| THROW | core | exception | lang | See documentation | |
| TO | I | core | coreext | lang | Stores quantity in a VALUE |
| TRUE | core | coreext | lang | ( -- true ) Push true constant | |
| VALUE | core | coreext | lang | Declares mutable constant | |
| VARIABLE | core | core | lang | Create a global variable. At run time, the variable's name pushes its data address | |
| WHAT'S | I | core | pforth | lang | ( <name> -- XT ) Grabs XT of a deferred word |
| WORD | ID_WORD | core | lang | ( char "<char>sss<char>" -- caddr ) Parse by given delimiter, return address | |
| \ | I | core | coreext | lang | Comment to end-of-line |
These words implement loops and selection statements.
| Word Name | Flags | Source Definition | ANS Section | Language Category | Description |
|---|---|---|---|---|---|
| +LOOP | I | core | core | flow | ( n -- ) Add n to loop counter, continue looping if not done |
| ?DO | I | core | coreext | flow | Like DO loop but no iterations are performed if initial value equals upper limit |
| AGAIN | I | core | coreext | flow | Repeat unconditionally from BEGIN |
| AHEAD | I | core | progtools | flow | Implements loop structures |
| BEGIN | I | core | core | flow | Implements loop structures |
| CASE | I | core | coreext | flow | Begin CASE/OF/ENDOF/ENDCASE structure |
| DO | I | core | core | flow | Begin definite loop |
| ELSE | I | core | core | flow | Introduce ELSE clause of IF/ELSE/THEN statement |
| ENDCASE | I | coreext | coreext | flow | Terminates CASE structure |
| ENDOF | I | core | coreext | flow | Terminates OF clause of CASE/OF/ENDOF/ENDCASE structure |
| I | ID_I | core | flow | ( -- n ) Pushes innermost loop index in a definite loop | |
| IF | I | core | core | flow | Begin IF/ELSE/THEN statement |
| J | ID_J | core | flow | ( -- n ) Pushes next-innermost loop index in a definite loop | |
| LEAVE | I | core | core | flow | Leaves a definite loop prematurely |
| LOOP | I | core | core | flow | Increment loop count, if equal to limit, terminate loop, otherwise loop from beginning |
| OF | I | core | coreext | flow | Start OF clause in a CASE statement |
| RANGEOF | I | core | pforth | flow | Used to implement CASE |
| REPEAT | I | core | core | flow | Repeat from start of BEGIN block |
| THEN | I | core | core | flow | Mark end of IF/ELSE/THEN statement |
| UNLOOP | core | core | flow | Must call prior to EXIT when in the middle of a loop | |
| UNTIL | I | core | core | flow | ( x -- ) Continue looping at BEGIN if x is zero |
| WHILE | I | core | core | flow | Loop while flag on stack is non-zero |
These words implement formatted and unformatted number display as well as character I/O.
| Word Name | Flags | Source Definition | ANS Section | Language Category | Description |
|---|---|---|---|---|---|
| # | core | core | io | Part of formatted number I/O | |
| #> | core | core | io | Part of formatted number I/O | |
| #S | core | core | io | Part of formatted number I/O | |
| . | ID_DOT | core | io | ( n -- ) Display n | |
| ." | I | core | core | io | ( "chars" -- ) Display string at run time |
| .R | coreext | coreext | io | ( n1 n2 -- ) Display n1 right-aligned in a field n2 characters wide | |
| .S | ID_DOTS | progtools | io | Display values on the stack | |
| <# | core | core | io | Part of formatted number I/O | |
| ? | progtools | progtools | io | ( addr -- ) Display value at addr (equivalent to "@ .") | |
| ACCEPT | ID_ACCEPT | core | io | ( addr n1 -- n2) Input string of at most n1 chars into addr. n2 is length of string. | |
| BL | core | core | io | ( -- 0x20 ) An ASCII blank (space) character | |
| CR | ID_CR | core | io | Print carriage return | |
| D. | double | double | io | ( d -- ) Display double-word in free-field format | |
| D.R | double | double | io | ( d -- ) Display double-word right-aligned | |
| DECIMAL | core | core | io | Set current numeric base to 10 | |
| DUMP | ID_DUMP | progtools | io | ( addr u -- ) Dump memory for u bytes at addr | |
| ECHO | ID_VAR_ECHO | pforth | io | ( -- addr ) Get address of variable controlling echo mode | |
| EMIT | D | ID_EMIT_P | core | io | ( x -- ) Display character with ASCII code x |
| EOL | ID_EOL | pforth | io | ( -- '\n' ) Pushes newline character onto stack | |
| HEX | core | coreext | io | Sets BASE to 16 | |
| HOLD | core | core | io | ( char -- ) Adds character to formatted output | |
| KEY | ID_KEY | core | io | ( -- n ) Pushes next key from terminal (waits for it) | |
| KEY? | ID_QTERMINAL | facility | io | ( -- flag ) Returns true if key is available from terminal | |
| OUT | ID_VAR_OUT | pforth | io | ( -- addr ) Get address of variable with current output column | |
| REFILL | ID_REFILL | coreext | io | ( -- flag ) Get another line of input. Flag is true if successful. | |
| SIGN | core | core | io | Formatted number output | |
| SPACE | core | core | io | Emit a single space | |
| SPACES | core | core | io | ( n -- ) If n>0 emit this many spaces | |
| TYPE | ID_TYPE | core | io | ( caddr u -- ) Display u bytes of string at caddr to terminal | |
| U. | core | core | io | ( u -- ) Display unsigned u in free field format | |
| U.R | coreext | coreext | io | ( u n -- ) Display u right aligned in a field n wide |
These words implement string operations.
| Word Name | Flags | Source Definition | ANS Section | Language Category | Description |
|---|---|---|---|---|---|
| -TRAILING | strings | strings | string | (addr u1 -- addr u2 ) Reduce string addr/u1 to addr/u2 to eliminate trailing spaces | |
| .( | I | core | coreext | string | Parse and display string delimited by ending ) |
| /STRING | core | strings | string | ( addr u1 n -- addr2 u2 ) Chop n characters from the front of the given string | |
| BLANK | strings | strings | string | ( addr u -- ) Set u characters to spaces beginning at addr | |
| CHAR | core | core | string | ( "n" -- 'n' ) Convert next single-letter word to its ASCII integer code | |
| COMPARE | ID_COMPARE | strings | string | ( addr1 u1 addr2 u2 -- n ) Compare two strings, n is 0 if the same, else -1 or +1 | |
| COUNT | core | core | string | ( addr -- addr+1 u ) Convert counted string address to address+count | |
| PARSE | core | coreext | string | ( char "ccc<char>" -- caddr u ) Parse with delimiter char, return addr/length. | |
| PLACE | core | pforth | string | ( addr len dest -- ) Moves a string to given destination | |
| S" | I | core | core | string | Compilation: return given string ( -- caddr u ) at run-time |
| SCAN | ID_SCAN | pforth | string | ( addr cnt char -- addr' cnt' ) Find character in string | |
| SEARCH | strings | strings | string | ( addr1 u1 addr2 u2 -- addr3 u3 flag ) Search for str2 in str1, set flag if found | |
| SKIP | ID_SKIP | pforth | string | ( addr cnt char -- addr' cnt' ) Skip over char in string | |
| SLITERAL | I | strings | strings | string | Compile in a string to return ( -- addr u ) at run time |
These words perform double-word (i.e., 2 cells) mathematical operations.
| Word Name | Flags | Source Definition | ANS Section | Language Category | Description |
|---|---|---|---|---|---|
| (D.) | double | pforth | double | ( d -- caddr cnt ) Converts a double to string representation | |
| 2CONSTANT | double | double | double | ( dl dh "name" -- ) Create double-word constant | |
| 2LITERAL | I | ID_2LITERAL | double | double | ( x1 x2 -- ) At run-time, place x1 and x2 on the stack |
| 2ROT | double | double | double | ( x1 x2 x3 x4 x5 x6 -- x3 x4 x5 x6 x1 x2 ) Double-word stack rotation | |
| 2VARIABLE | double | double | double | Create a global double-word variable | |
| D+ | ID_D_PLUS | double | double | ( d1 d2 -- d1+d2 ) Double-word addition | |
| D- | ID_D_MINUS | double | double | ( d1 d2 -- d1-d2 ) Double-word subtraction | |
| D0< | double | double | double | ( d -- flag ) Set flag true if double-word d<0 | |
| D0= | double | double | double | ( d -- flag ) Set flag true if double-word d=0 | |
| D2* | double | double | double | ( d -- d<<1 ) Arithmetic double-word left shift | |
| D2/ | double | double | double | ( d -- d>>1 ) Arithmetic double-word right shift | |
| D< | ID_D_LESSTHAN | double | double | ( d1 d2 -- flag ) Set flag true if double-word d1<d2 | |
| D= | double | double | double | ( d1 d2 -- flag ) Set flag true if double-word d1=d2 | |
| D>S | double | double | double | ( d -- n ) Convert double-word to single-word number | |
| DABS | double | double | double | ( d -- |d| ) Double-word absolute value | |
| DMAX | double | double | double | ( d1 d2 -- max(d1,d2) ) Maximum function for double-words | |
| DMIN | double | double | double | ( d1 d2 -- min(d1,d2) ) Minimum function for double-words | |
| DNEGATE | core | double | double | ( d1 -- -d1 ) Negative function for double-words | |
| DU< | ID_D_ULESSTHAN | double | double | ( ud1 ud2 -- flag ) Set flag true if unsigned double-word ud1<ud2 | |
| M*/ | double | double | double | ( d1 n1 +n2 -- d1*n1/n2 ) Quotient is double-word, d1*n1 is triple-word | |
| M+ | double | double | double | ( d n -- d+n ) Double-word addition to single-word | |
| MU/MOD | ID_D_MUSMOD | pforth | double | ( AL AH B -- REM QL QH ) 32/16 unsigned divide, 32-bit result | |
| S>D | core | core | double | ( n -- d ) Sign-extend n to double-cell d |
These words are concerned with manipulating memory locations.
| Word Name | Flags | Source Definition | ANS Section | Language Category | Description |
|---|---|---|---|---|---|
| ! | ID_STORE | core | memory | ( n addr -- ) Store 16-bit n at address | |
| +! | ID_PLUS_STORE | core | memory | ( n addr -- ) Add n to the 16-bit contents of given address | |
| 2! | core | core | memory | ( LSB MSB addr -- ) 32-bit store: store MSB at addr, LSB at addr+1 | |
| 2@ | core | core | memory | ( addr -- LSB MSB ) 32-bit fetch of contents at addr | |
| @ | ID_FETCH | core | memory | ( addr -- x ) Fetch 16-bit value at given address | |
| C! | ID_CSTORE | core | memory | ( x1 addr -- ) Store 8 least-significant bits of x1 at addr | |
| C@ | ID_CFETCH | core | memory | ( addr -- x ) Fetch 8-bit character at given address | |
| CELL+ | core | core | memory | ( addr -- addr+2 ) Increment address by 2 bytes (size of a cell) | |
| CELL- | core | pforth | memory | ( addr -- addr-2 ) Decrement address by 2 bytes (size of a cell) | |
| CELLS | core | core | memory | ( x -- x<<1 ) Multiply x by 2 (size of a cell) | |
| CMOVE | ID_CMOVE | strings | memory | ( addr1 addr2 u -- ) Copy u characters from addr1 to addr2 (low addresses to high) | |
| CMOVE> | ID_CMOVE_UP | strings | memory | ( addr1 addr2 u -- ) Copy u characters from addr1 to addr2 (high addresses to low) | |
| ERASE | coreext | coreext | memory | ( addr u -- ) Set u bytes of memory to 0 starting at addr | |
| FILL | ID_FILL | core | memory | ( addr num val -- ) Fill num bytes starting at addr with 8-bit val | |
| MOVE | core | core | memory | ( addr1 addr2 u -- ) Move u bytes from addr1 to addr2 | |
| PAD | core | coreext | memory | ( -- caddr ) Address of a temporary region for intermediate processing |
Preprocessor words can be used for conditional compilation.
| Word Name | Flags | Source Definition | ANS Section | Language Category | Description |
|---|---|---|---|---|---|
| EXISTS? | I | progtools | pforth | preprocess | ( <name> -- flag ) Sets flag if given name is a defined word |
| [ELSE] | I | progtools | progtools | preprocess | Conditional compilation |
| [IF] | I | progtools | progtools | preprocess | Conditional compilation |
| [THEN] | I | progtools | progtools | preprocess | Conditional compilation |
These words are not easily categorized, hence are grouped here.
| Word Name | Flags | Source Definition | ANS Section | Language Category | Description |
|---|---|---|---|---|---|
| #COLS | coreext | pforth | utility | Constant setting # of columns per screen for WORDS | |
| 0STACKP | core | pforth | utility | ( stack -- ) Flush user stack | |
| :STACK | core | pforth | utility | ( #cells "name" -- ) Define a user stack variable of given name | |
| >NEWLINE | core | pforth | utility | Print newline but only if output is not at column 0 | |
| >STACK | core | pforth | utility | ( n stack -- ) Push onto user stack, postincrement | |
| ?ERROR | ID_ERRORQ_P | pforth | utility | ( flag num -- ) Prints error code num if flag true | |
| ASCII | I | core | pforth | utility | ( <char> -- char ) NOTE: State-smart |
| AUTO.INIT | core | pforth | utility | Executed prior to accepting first interactive command | |
| AUTO.TERM | core | pforth | utility | Executed upon 'bye' | |
| BYE | ID_BYE | progtools | utility | Terminates interpreter | |
| CR? | coreext | pforth | utility | Carriage return if output column near #COLS | |
| EDITOR | progtools | utility | Swap wordlists with the editor wordlist (NOT IMPLEMENTED in pForth) | ||
| STACK.PICK | core | pforth | utility | ( index stack -- n ) Grab Nth item from top of user stack | |
| STACK> | core | pforth | utility | ( stack -- n ) Pop from user stack, predecrement | |
| STACK@ | core | pforth | utility | ( stack -- n ) Copy from top of user stack | |
| STACKP | core | pforth | utility | ( stack -- ptr ) Pointer to next empty location on user stack | |
| TAB | coreext | pforth | utility | Go to next tab stop | |
| TAB-WIDTH | coreext | pforth | utility | Variable storing spaces per tab for printing WORDS | |
| TRACE-FLAGS | ID_VAR_TRACE_FLAGS | pforth | utility | ( -- addr ) Get address of variable with trace flags | |
| TRACE-LEVEL | ID_VAR_TRACE_LEVEL | pforth | utility | ( -- addr ) Get address of variable with trace level | |
| TRACE-STACK | ID_VAR_TRACE_STACK | pforth | utility | ( -- addr ) Get address of variable with trace stack setting | |
| WORDS | coreext | coreext | utility | Display current dictionary |
These words directly manipulate the Forth dictionary and code space areas.
| Word Name | Flags | Source Definition | ANS Section | Language Category | Description |
|---|---|---|---|---|---|
| , | core | core | dictionary | ( x -- ) Store x in exec area and advance exec pointer | |
| >BODY | core | core | dictionary | ( XT -- addr ) Used to implement VALUE/TO | |
| ALLOT | core | core | dictionary | ( n -- ) Increments exec pointer by n | |
| C, | core | core | dictionary | ( x -- ) Store 8 least-significant bits of x in exec area, bump up exec ptr by 1 byte | |
| CODE-BASE | ID_VAR_CODE_BASE | pforth | dictionary | ( -- addr ) Get address of start of code area | |
| CODE-LIMIT | ID_VAR_CODE_LIMIT | pforth | dictionary | ( -- addr ) Get address just beyond end of code area | |
| CONTEXT | ID_VAR_CONTEXT | pforth | dictionary | ( -- addr ) Get address of last dictionary definition name | |
| DP | ID_VAR_DP | pforth | dictionary | ( -- addr ) Get address of next code location to write to | |
| DUNUSED | core | pforth | dictionary | ( -- u ) Returns free space in dictionary area | |
| FINDNFA | ID_FINDNFA | pforth | dictionary | ( <name> -- addr 0 | nfa +-1 ) Find name in dictionary | |
| HEADERS-BASE | ID_VAR_HEADERS_BASE | pforth | dictionary | ( -- addr ) Get address of start of dictionary | |
| HEADERS-LIMIT | ID_VAR_HEADERS_LIMIT | pforth | dictionary | ( -- addr ) Get address just beyond end of dictionary area | |
| HEADERS-PTR | ID_VAR_HEADERS_PTR | pforth | dictionary | ( -- addr ) Get address of next dictionary entry to write | |
| HERE | ID_HERE | core | dictionary | ( -- x ) Push next location in exec area to be written to | |
| NAME> | ID_NAME_TO_TOKEN | pforth | dictionary | ( nfa -- xt ) Converts address of dict name to its XT | |
| PREVNAME | ID_NAME_TO_PREVIOUS | pforth | dictionary | ( nfa -- nfa ) Converts address of dict name to previous name's address | |
| UNUSED | core | coreext | dictionary | ( -- u ) Returns free space in exec area |
These words support the Forth implementation and are not likely to be directly used in Forth programs.
| Word Name | Flags | Source Definition | ANS Section | Language Category | Description |
|---|---|---|---|---|---|
| ", | core | pforth | compiler | ( addr len -- ) Places string into code space | |
| ((NUMBER?)) | core | pforth | compiler | Used to implement NUMBER? | |
| (+LOOP) | ID_PLUSLOOP_P | pforth | compiler | Used to implement +LOOP | |
| (.") | core | pforth | compiler | Used to implement ." | |
| (2LITERAL) | ID_2LITERAL_P | pforth | compiler | Runtime support for 2LITERAL, pushes next two words on stack | |
| (?DO) | ID_QDO_P | pforth | compiler | Used to implement ?DO | |
| (ABORT") | core | pforth | compiler | ( flag $message -- ) Calls ABORT if flag is true | |
| (ABORT) | exception | pforth | compiler | Throws -1...used to redefine ABORT if exception.ft is used | |
| (C") | core | pforth | compiler | Used to implement C" | |
| (COMPILE) | core | pforth | compiler | Used by COMPILE | |
| (CREATE) | ID_CREATE_P | pforth | compiler | Runtime support for CREATE | |
| (DO) | ID_DO_P | pforth | compiler | Runtime support for DO | |
| (DOES>) | core | pforth | compiler | Used to implement DOES> | |
| (EMIT) | ID_EMIT_P | pforth | compiler | Same as original EMIT | |
| (HEXNUMBER?) | ID_HEXNUMBERQ_P | pforth | compiler | ( $addr -- 0 | n 1 ) Convert string at address as hex number | |
| (IS) | core | pforth | compiler | Used to implement IS | |
| (LEAVE) | ID_LEAVE_P | pforth | compiler | Supports LEAVE | |
| (LITERAL) | ID_LITERAL_P | pforth | compiler | Supports LITERAL, pushes next code space word on stack | |
| (LOOP) | ID_LOOP_P | pforth | compiler | Supports loops | |
| (NUMBER?) | core | pforth | compiler | Used to implement NUMBER? | |
| (QUIT) | ID_QUIT_P | pforth | compiler | Original implementation of QUIT, calls abort | |
| (RANGEOF?) | core | pforth | compiler | Used to implement CASE | |
| (S") | core | pforth | compiler | Used to implement S" | |
| (WHAT'S) | core | pforth | compiler | Used to implement WHAT'S | |
| ," | core | pforth | compiler | ( "string" -- ) Parses string and stores in code space | |
| -1 | core | pforth | compiler | Equal to -1, saves one cell | |
| 0BRANCH | ID_ZERO_BRANCH | pforth | compiler | Supports flow control, branch if top-of-stack is 0 | |
| 0USP | core | pforth | compiler | Clear loop stack | |
| :NONAME | core | coreext | compiler | Define code body without associated dictionary name | |
| ;CODE | progtools | compiler | Add assembly language (NOT IMPLEMENTED in pForth) | ||
| <MARK | core | pforth | compiler | Used in forming flow control constructs | |
| <RESOLVE | core | pforth | compiler | Used in forming flow control constructs | |
| >IN | ID_VAR_TO_IN | core | compiler | ( -- addr ) Address of variable storing number of characters from TIB to parse area | |
| >MARK | core | pforth | compiler | Used in forming flow control constructs | |
| >NUMBER | core | core | compiler | ( ud1 addr1 u1 -- ud2 addr2 u2 ) See documentation | |
| >RESOLVE | core | pforth | compiler | Used in forming flow control constructs | |
| >US | core | pforth | compiler | Push to loop stack | |
| ?COMP | core | pforth | compiler | Ensures compilation state, otherwise errors out | |
| ?CONDITION | core | pforth | compiler | Checks that CONDITIONAL_KEY is at top-of-stack, otherwise errors out | |
| ?DO_FLAG | core | pforth | compiler | Used for implementing loops | |
| ?OF | I | core | pforth | compiler | Used to implement CASE |
| ALIGN | I | core | core | compiler | Does nothing (normally aligns data pointer to some boundary) |
| ALIGNED | I | core | core | compiler | Does nothing (normally bumps up address to next aligned boundary) |
| ASSEMBLER | progtools | compiler | Swap wordlists with the assembler wordlist (NOT IMPLEMENTED in pForth) | ||
| BRANCH | ID_BRANCH | pforth | compiler | Supports flow control, unconditional branch | |
| CASE-DEPTH | core | pforth | compiler | Used to implement CASE | |
| CATCH-HANDLER | core | pforth | compiler | Used to implement CATCH | |
| CELL | core | pforth | compiler | 2, the size in bytes of a cell | |
| CHARS | I | core | core | compiler | ( n -- n ) Doesn't do anything (multiplies by sizeof(char)) |
| CHECK.DEFER | core | pforth | compiler | Used to implement DEFER | |
| CHECK.STACK | core | pforth | compiler | Prints error message and calls ABORT if stack underflow | |
| CODE | progtools | compiler | Assembly language (NOT IMPLEMENTED in pForth) | ||
| COMPILE, | core | coreext | compiler | ( XT -- ) Append XT to exec area at current pointer, increment pointer | |
| CONDITIONAL_KEY | core | pforth | compiler | Magic number used in forming conditional flow control | |
| CREATE | ID_CREATE | core | compiler | Create a new word in the dictionary | |
| DIGIT | core | pforth | compiler | ( char base -- n true | char false ) Convert a single character to a number in the given base | |
| DOES> | I | core | core | compiler | Describe body of word defined with CREATE |
| DO_FLAG | core | pforth | compiler | Used for implementing loops | |
| ENVIRONMENT? | core | compiler | NOT IMPLEMENTED | ||
| FIND&COMPILE | core | pforth | compiler | ( $word -- {n} ) Find word in dictionary and compile/execute it | |
| FORGET.NFA | coreext | pforth | compiler | ( nfa -- ) Core of FORGET algorithm | |
| FREEZE | coreext | pforth | compiler | Sets RFENCE to current code space address. | |
| GDB-BREAK | I | ID_GDB_BREAK | pforth | compiler | Empty routine for setting GDB debugger breakpoints |
| HLD | core | pforth | compiler | Used to implement HOLD | |
| ID. | core | pforth | compiler | ( nfa -- ) Prints string at given address, masking off length character | |
| INTERPRET | core | pforth | compiler | Keeps parsing words, calling FIND&COMPILE for each one | |
| LATEST | core | pforth | compiler | Return address of last word defined | |
| LEAVE_FLAG | core | pforth | compiler | Used for implementing loops | |
| LOOP-BACK | core | pforth | compiler | Used for implementing loops | |
| LOOP-FORWARD | core | pforth | compiler | Used for |