Skip to content

Instantly share code, notes, and snippets.

@SimonMeskens
Created February 5, 2025 01:15
Show Gist options
  • Save SimonMeskens/0c435cd21201ea0b88a0410e82f0c93e to your computer and use it in GitHub Desktop.
Save SimonMeskens/0c435cd21201ea0b88a0410e82f0c93e to your computer and use it in GitHub Desktop.
WIP - Stream automata for a turing machine equivalent to concatenative programming.

Copyright 2025 Simon Meskens Licensed under the MIT License

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided this license is preserved. This software is offered as-is, without any warranty.

Stream Machine: An abstract machine with a transition table, no machine state and a finite number of lazy stacks. One of the stacks is the program stack and after each transition, the top of the program stack is popped off. The top of the the program stack is the first input to the transition table.

Straight Line Stream Machine: Stacks: program stack, data stack. Inputs: top of program stack. Decisions: pop data, push value to data.

Finite State? Stream Machine: Stacks: program stack, data stack. Inputs: top of program stack, top of data stack. Decisions: pop data, push value to data.

Pushdown? Stream Machine: Stacks: program stack, rewind stack, data stack. After each transition, the current instruction is not just popped, but pushed onto rewind. Inputs: top of program stack, top of data stack. Decisions: pop data, push value to data, rewind finite number of items back onto the program stack.

Turing? Stream Machine: Stacks: program stack, rewind stack, 2x data stack. After each transition, the current instruction is not just popped, but pushed onto rewind. Inputs: top of program stack, top of data stack. Decisions: pop data 1 or 2, push value to data 1 or 2, rewind finite number of items back onto the program stack.

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