From 9ac53463c56dd57a84036a6944e6b4e5d3829e9c Mon Sep 17 00:00:00 2001 From: kitty Date: Wed, 8 Apr 2026 17:30:24 +1000 Subject: some erroring stuff --- readme.md | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'readme.md') diff --git a/readme.md b/readme.md index b5eae4b..df4c021 100644 --- a/readme.md +++ b/readme.md @@ -58,6 +58,10 @@ have a closing bracket: ). ### `(0handler) ( -- )` the very early error handler, which simply quits the program. +### `(abort") ( ? -- )` +perform the runtime actions of `abort"`: +check for non-zero and print and abort, or do nothing. + ### `(create) ( -- )` the default behaviour of a word made by `create`, which simply pushes the address following the definition to the stack. @@ -121,6 +125,10 @@ of a `value`. (in compile mode u is whatever was on the stack already.) rotate the three topmost values on the stack so that the topmost value is moved to the third highest. +### `." ( -- ) IMMEDIATE COMPILE-ONLY` +compile into the current definition the following string (terminated by `"`) +being written to output. + ### `/buffer ( -- u )` the size of an input buffer. @@ -228,13 +236,13 @@ if a word was found, its link field address is returned along with the true flag. if no word was found or the string is of length zero, abort. -### `?notfound ( -- )` +### `?notfound? ( -- )` produce a word not found error. -### `?overflow ( -- )` +### `?overflow? ( -- )` produce a stack overflow error. -### `?underflow ( -- )` +### `?underflow? ( -- )` produce a stack underflow error. ### `0= ( n -- ? )` @@ -271,6 +279,11 @@ duplicate the two topmost values on the stack. call the error handler (the address of which is in the variable `handler`) +### `abort" ( ? -- ) IMMEDIATE COMPILE-ONLY` +if `?` is non-zero, write the message that follows (terminated by `"`) +to standard out then call the error handler. +(the address of which is in the variable `handler`) + ### `again ( -- ) IMMEDIATE COMPILE-ONLY` complete an infinite loop began by the word `begin`. @@ -418,6 +431,10 @@ remove the value at the top of the stack. ### `dup ( u -- u u )` duplicate the value at the top of the stack. +### `e." ( -- ) IMMEDIATE COMPILE-ONLY` +compile into the current definition the following string (terminated by `"`) +being written to error output. + ### `else ( -- ) IMMEDIATE COMPILE-ONLY` update the current if statement to branch here when the flag is false, @@ -426,6 +443,9 @@ and skip to `then` if the corresponding `if` was true. ### `emit ( c -- )` print the single character c to output. +### `etype ( a u -- )` +write u characters at a to error output. + ### `executable ( a u -- )` marks the u bytes starting at address a as executable. this is used primarily to mark the program break, @@ -638,6 +658,9 @@ yield the address of the stack pointer. note that the address points to the stack *before* this value is pushed. +### `sp-reset ( -- )` +reset the working stack pointer to its starting value. + ### `state ( -- a )` a variable containing a boolean value. if 0 (false), the system is in interpreting mode, -- cgit v1.2.3