Skip to content

LTR stack on left? #11

Description

@cben

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:

  • move stack to left of editor
  • orient stack left-to-right
  • dim "consumed" words from start to cursor.

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
    [█▓▒░ ]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions