fix: qdup/tuck/2swap bugs, getline, and cached word pointers

Co-authored-by: aider (openrouter/moonshotai/kimi-k2.6) <aider@aider.chat>
This commit is contained in:
2026-05-03 21:39:52 +03:00
parent bf3c15ec27
commit b115744991
7 changed files with 106 additions and 89 deletions
+3 -3
View File
@@ -10,7 +10,7 @@ This is a toy/subset Forth interpreter designed for educational purposes. It pro
- **Threaded Code**: The interpreter uses an inner/outer interpreter model. Colon definitions are sequences of word addresses (threaded code) traversed by an instruction pointer.
- **Architecture**:
- 32-bit signed integer cells (`int32_t`)
- 64-bit signed integer cells (`int64_t`)
- Separate data and return stacks
- Fixed-size dictionary, user memory, and compile buffer
- Dictionary is a singly-linked list searched linearly
@@ -23,8 +23,8 @@ This is a toy/subset Forth interpreter designed for educational purposes. It pro
- Memory access (`@`, `!`, `C@`, `C!`, `HERE`, `ALLOT`)
- Simple string output (`."`)
- **Limitations**:
- Fixed memory limits (dictionary, stacks, user memory)
- 32-bit signed integers only; no floating-point support
- Fixed user memory limit (1M cells); dictionary and stacks grow dynamically
- 64-bit signed integers only; no floating-point support
- No file I/O or operating system interface beyond stdin/stdout
- No immediate user-defined words or advanced introspection
- Single-threaded execution