Draft: Live Rewriting Under Concatenative Programming
. To be finalised after the workshop.Concatenative programming languages offer attractive ergonomics for some applications, but are also sometimes called "write-only languages" because programs can fall into convoluted stack-juggling that is difficult to follow. Rewriting systems also offer some very straightforward expressions of some classes of problem, but face complex workarounds in others. Many of these strengths and limitations are complementary: advanced multi-step stack-juggling is complex and hard to follow as concatenative functions, but would be trivially expressed as rewrites over the stack, while rewriting systems often make negation and ordinal comparisons complicated.
Here we present a multi-stack concatenative programming system operating over a rewriting substrate: functions can be defined in conventional concatenative style, or as rewriting operations, or even combinations of both, and all application proceeds by rewriting the remaining program and state. In doing so, new possibilities for run-time intervention are exposed: the program can be paused and both state and pending code can be edited, including the equivalent of the call stack, but yet more dynamic options are also available, including evaluating other programs ad hoc within the main program's state. We also identify bindings between program-level stacks and external resources that can allow bidirectional direct manipulation of visible state.