Mentioned sync and abort in README

This commit is contained in:
StackSmith 2023-09-14 19:31:05 -04:00
parent ff458effa0
commit 5840299a65
1 changed files with 8 additions and 1 deletions

View File

@ -13,10 +13,17 @@ WIP. Defining and running simple code, loading/compiling secondary files.
nForth is not ANS (or anything) compliant. Major deviations:
### Always Compile
To avoid the whole state morass, nForth is *always* in compile mode. Text is parsed, compiled, executed, and erased. Defining words manipulate the execution and erasure points.No more [IF] and such. [ ... ] may be used to group compile a group of words as a single unit:
To avoid the whole state morass, nForth is *always* in compile mode. Text is parsed and compiled. To actually execute anything, surround the code with square braces (such code will be erased after execution).
```
OK> [ " Hello" type cr ]
```
### Sync points
When the dictionary is in a good state, create a checkpoint with `sync` immediate word. To revert to the previous checkpoint, use `abort`. `..` is a convenience word that executes all code compiled after the previous checkpoint and deletes it, so instead of the previous example you can do:
```
OK> sync
OK> " Hello" type cr ..
Hello
```
### Hashes, not Names
Symbolic names are not stored in the dictionary. Names are instead hashed at definition time using FNV1a to a 32-bit value and stored in heads. Dictionary searches are simplified to a 32-bit comparison instead of a string comparison, and heads are always 8 bytes long.