https://www.youtube.com/watch?v=EkzoevQ19Pk shows a very nice layout for visualizing stack-based language execution, also similar to http://www.nsl.com/k/xy/xy.htm model (and probably has been re-invented many times):
| stack |
current-word |
continuation |
|
|
3 square 4 square + |
|
3 |
square |
| 3 |
|
dup * · 4 square + |
| 3 |
dup |
* · 4 square + |
| 3 3 |
* |
· 4 square + |
| 9 |
4 |
square + |
| 9 4 |
square |
+ |
| 9 4 |
|
dup * · + |
| 9 16 |
+ |
|
| 25 |
|
|
- the whole program starts on the right
- taking a step takes first word from continuation and executes it
- that usually does something to right edge of stack, e.g. numbers just shift left :-)
- a definition can be "exploded" back into the continuation
- its end is marked with a no-op · which supports "jump over" to complete function execution, instead of default single-stepping.
However, I want to keep text editable, don't want it to actaully disapper.
But things I can do to approach this:
Hmm, the program is not necessarily horizontal 🤔 It can consist of many lines.
(Current vertical stack layout inspired by terminal REPL where each word was typed on separate line and stack was printed vertically between words:
black
[█]
white
[█]
[ ]
fade
[█▓▒░ ]
https://www.youtube.com/watch?v=EkzoevQ19Pk shows a very nice layout for visualizing stack-based language execution, also similar to http://www.nsl.com/k/xy/xy.htm model (and probably has been re-invented many times):
However, I want to keep text editable, don't want it to actaully disapper.
But things I can do to approach this:
Hmm, the program is not necessarily horizontal 🤔 It can consist of many lines.
(Current vertical stack layout inspired by terminal REPL where each word was typed on separate line and stack was printed vertically between words: