StrML
| Designed by | User:SirBrahms |
|---|---|
| Appeared in | 2026 |
| Computational class | Unknown |
| Reference implementation | Not implemented |
| File extension(s) | .sml |
StrML, or String Modification Language, is an esoteric programming language based around modifying a string. Any StrML program is a function executed on a base string, transforming said base string into a new string, which may be empty. Additionally, input can be taken from a secondary input string, which is however immutable.
Instructions
StrML uses Brainfuck-like syntax, meaning it operates on both strings as if they were a dynamic array of characters. Thus, the program keeps track of two indices, one for the base string and one for the input string. For greater efficiency and readability, two different instruction sets are used, depending on which of the two strings is being referenced. 'X', 'Y', 'Z' and 'A' are considered wildcards and can be any character.
| Base String Instruction | Input String equivalent | Meaning |
|---|---|---|
>
|
`
|
Adds one to the base string index. If at the end of the string, the string is expanded. All automatically expanded characters are initialised to the character '0' |
<
|
,
|
Subtracts one from the base string index. If at the beginning of the string, the string is again expanded with the character '0' |
^
|
@
|
Sets the index to the first character of the base string |
$
|
/
|
Sets the index to the last character of the base string |
X?
|
X!
|
Skips the next instruction if the character at the current index is X |
X
|
n/a | Substitutes the current character with X. If X is the null terminator, the base string's length is set to the current index, and said index is automatically reduced by one. See also Section Escapes |
_
|
n/a | Substitutes the current base string character with the character at the current input string position. If the current input string position is out of bounds (i.e. the index is larger than the length), this operation will always return the null terminator \0 |
+
|
n/a | Adds one to the ASCII value of the current base string character |
-
|
n/a | Subtracts one from the ASCII value of the current base string character |
{XYZ}
|
n/a | Groups instructions together so they count as one instruction. |
X[YZA]
|
n/a | Groups instructions so YZA count as one instruction and repeats the enclosed instructions until X skips over the grouped instructions. Loops indefinitely if X is not ?, but X still gets executed! |
;
|
n/a | Halts the program |
A StrML Program is represented as follows:
base, input → "Actions" → output
Escapes
All instructions mentioned above can be escaped using a backslash. When escaped in this manner, they count as their literal character values instead of their associated instruction. Number characters are usually interpreted as their ASCII symbols, not as their literal values, and must be escaped with a backslash as well if their literal value should be referenced.
Examples
The following are theoretical examples, as the language is not yet implemented.
Truth Machine
base → “0?[1>1]” → 0 if base = 0, else 1111...
String Comparison
base, input →“$/\0?[_?;\0,]” → empty string if equal, else non-empty
String Concatenation
base, input → “$\0![>_`]” → base+input