esolang

str

A tool for modifying streams, character by character.

Conor O'Brien, 2026 · Turing complete: unknown · ●●○ moderate · esolangs.org

Tested with 7 known programs · Hello World on Try It Online: identical · Test method

Run it

Expected: Hello, World!

The idea

str is a stack language by Conor O'Brien, written in Ruby, built around a stream. The program is cut at ; into up to three parts. The first runs once before any input. The second runs once for every byte of input, with that byte pushed as a one-character string, and whatever is left on top is printed. The third runs once at the end.

Read the story

So a program with no ; at all is a filter. X alone adds one to every character, which turns HAL into IBM. Put the work in front of a ; and it runs once, which is how the Hello World works.

Most commands work on integers and strings alike. On a string, arithmetic goes one code point at a time, so X increments every character and + with a number shifts them all.

The machine

CommandDoes
12, `text` , 'c, [code]Push a number, a string, one character, or code as a string
~ $ d H JSwap, drop, duplicate, copy the nth item, bring the nth up
+ - * / % ^Arithmetic, or the same on each code point of a string
< > = NCompare, giving 1 or 0; N is 1 for 0
S X Y _ y c m MLength, increment, decrement, reverse, code, character, to string, to number
x : a K kRepeat, join, index, slices
o O r R pPrint, with a newline, in backticks, with sprintf
g G I lRead a byte, n bytes, a number, the rest
? , .If the top is 0 skip to ,; a , skips to .
! f &:x &xRun a string; name it as a command; store it; fetch and run it
b u q WBuffer a value, take it back, no print this time, show the stack at the end

Popping an empty stack ends the program. Integers have no size limit.

Example

The fourth one is a quine.
Expected: IBM
Expected: hELLO
Expected: `dro;`dro;
Expected: 3

The fourth one is a quine. It pushes the string dro;, duplicates it, prints one copy in backticks with r and the other plain with o. The last counts the input. The preamble pushes 0, the body drops each byte, adds one to the count and turns off its print with q, and the end prints the count.

Patterns it teaches

  • Stack machines: one stack, with the input fed onto it a byte at a time.
  • Quines: r prints a string the way it is written in the source, which makes quines short.

Try this

  1. Turn every letter of the input into upper case.
  2. Print the input with every a taken out.
  3. Hard: print the input backwards, using the buffer or the postamble.

Further

Not the same language as the stack roller called Str on esolangs.org.

Not the same language as the stack roller called Str on esolangs.org.

Stack-based

Write your own in Run Convert a program from str

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: str.

Command line

shib run str -e 'X' --input 'HAL'
shib manual str

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/str.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org