Streamix
Jump to navigation
Jump to search
Streamix is a brainfuck based esolang. All I/O goes only on streams. Also, all instructions are ASCII-lowercase.
General
Memory
Memory in Streamix is array of 16-bit cells. It has infinite size, so interpreter should extend it sometimes. Current cell is a cell onto pointer.
Queue
Some data, usually I/O data, contains in FIFO queue. Reading value from queue removes read value from queue.
Streams
Stream is actually number, mapped on file descriptor. Streams 0, 1 and 2 are stdout, stdin and stderr respectively. Other streams may be opened with f command. Current stream is a stream with current cell value as stream number.
Instructions
| Instruction | Description |
|---|---|
| i/d | Increments/decrements current cell by 1 |
| s | Squares value of current cell |
| z | Sets current cell value to 0 |
| p/n | Moves pointer left or right one cell |
| b/e | Simular to [ and ] in brainfuck |
| o | Puts string in double quotes to current stream |
| a | Puts value from queue to current stream as raw byte |
| x/r/l | Same, but as hexadecimal/decimal/BCD |
| f | Opens file in "a+b" mode, name specifiend in string in double quotes. Puts its stream ID to current cell |
| c | Closes current stream |
| g | Reads one byte from current stream to queue |
| q | Puts current cell value to queue |
| u | Reads value from queue to current cell |
Computational class
Turing-complete, proven by trivial reduction to brainfuck:
| Brainfuck | Streamix |
|---|---|
| <> | pn |
| +- | id |
| [] | be |
(I/O not required for Turing-completeness)
Examples
o"Hello, World!"
ibgdaie