EDIT: A previous version of this issue incorrectly stated the problem. The problem does not relate to word not found errors as previously stated.
The current RetroForth REPL behavior differs slightly from what I expected from a traditional Forth.
In REPL mode, a stack underflow error will exit the process:
$ retro
RETRO 12 (2021.7)
524288 Max, 15004 Used, 509284 Free
s:put
ERROR (nga/execute): Stack Limits Exceeded!
At 9320, opcode 29. sp = -1
$
This behavior is unlike most desktop Forth systems (GForth, PForth, etc..), which recover from such an error.
See some related discussion at http://forth.chat/logs/libera/retro/2021-06-16
So the current behavior is handled by the VM. I think the way to address this will be to extend it a bit.
- add separate handlers for address & data stack overflow & underflow
- add an I/O device for mapping these to Retro words
- extend the retro-unix.retro to add handlers
This won't change the current behavior under the minimal system (repl.c, etc), but might be worth doing for the main C and Python implementations.
Additionally, this could be an opportunity to do something similar for invalid instruction handling. I could see it being used for an extended version of autopsy, offering more options for debugging.