We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
SMISC
| Paradigm(s) | imperative |
|---|---|
| Designed by | User:Obuqwe |
| Appeared in | 2026 |
| Dimensions | one-dimensional |
| Computational class | Turing complete |
| Major implementations | original |
| File extension(s) | .sm |
SMISC (or Smisc) is a self-modifying esolang created by User:Obuqwe in 2026. The main principle of this language is that the code is both memory and code. Using just 4 base instructions swap, copy, input, output to manage logic and control flow.
Language description
Smisc code is ran line by line starting at the first (line 1.) It runs until it reaches the end of the file, at which it may loop back to the first line. The program will loop if any of the 4 base instructions have been hit at least once in this cycle. Meaning the only way for the program to halt is to effectively erase itself. The program cannot alter how many lines it has during runtime.
The only type of variable are unsigned integers. The user may write character literals in the code itself which will be converted to the character's corresponding value whenever it is used. The only valid quote character is "
Instructions
| Instruction | Description |
|---|---|
swap n a b |
Swap n amount of lines from line a to line b
|
copy n a b |
Swap n amount of lines from line a to line b
|
input n a |
Take n characters as input from the user and place it starting on line a
|
output n a |
Outputs n amount of lines starting from line a. Each line will be evaluated and it'snumber value will be outputted as it's corresponding character value. All instruction calls evaluate to 0 |
Expressions & Literals
Expressions are allowed both in the main function body and as an argument inside an instruction call. They are written use polish notation and allow the use of brackets to nest expressions inside other expressions. Expressions that are an argument to an instruction call must be inside brackets. When they're evaluated inside the main program body, the line it's on is overwritten by the value it evaluated to.
There are 5 self-explanatory maths operations that are available to the user: +, -, *, /, and >. These are written using polish notation. Meaning the symbol is written first, and then it's two parameters are written after it.
-- a bunch of different expressions + 1 4 + ( > 2 5134 ) 12 - "?" 48 * ( / 2 412) ( > "f" "b") -- an expression inside an instruction call swap ( + ( > 32 10 ) 100 ) ( - 42 1) 0
Literals are any value that is written that doesn't need Evaluation. Any number or string literal on it's own line or inside an expression. String literals longer then one character be expanded onto multiple lines when the program is first run. This is done when the program is parsed, not in runtime.
output 4 2 "abc" 10 -- will become -> output 4 2 "a" "b" "c" 10
Labels
Labels are a way to reference certain lines of code without having to directly point to them with numbers. They are indicated by a period followed by a name, without any space between. The label refers to the line immediately after it
-- label points to 1942 . my-label 1942 9812 4294
Labels can be used inside expressions. If you write the label name with a period infront of it, it will evaluate to the line it's labeling. If not, it will evaluate and return the value of the first line it refers to.
+ my-letters 1
-- will output "b" ("a" + 1 )
output 1 1
. my-letters
"a"
"?"
"@"
Comments
Comments are lines that are ignored by the interpreter. They are indicated with two minus symbols and a space (-- ). All text proceeding this will be ignored until then next newline. While comments themselves are ignored, the line they're on is still a valid place to swap, copy, or refer to.
Etymology
SMISC (or Smisc) is an acronym for Self-Modifying Instruction Set Computer. It's a play on other similar acronyms, namely RISC (Reduced Instruction Set Computer) and OISC (One Instruction Set Computer).
Computational class & Use
Smisc is highly likely to be turing complete. As one could emulate a tape memory with a large amount of empty lines, and use swap and copy to read and dictate what to do with said data. This language would still retain its turing completeness if swap was removed. Though it's inclusion makes writing programs in it slightly easier.
Numbers
Numbers in Smisc are 32-bit unsigned integers. There is no underflow or overflow protection.
Truth machine
This program works by clearing itself if the input is zero, after already having printed it once. If it doesn't clear itself, it'll simply repeat.
. n input 1 . n output 1 . n copy ( * 2 ( > 1 ( - n 48 ) ) ) 1 3
Hello, World!
This is the smallest possible hello world program in Smisc. Though it's important to remember that the text will be expanded when parsed
output 13 2 "Hello, World!" copy 1 2 1 copy 2 2 15
hello world program after expanding the text...
output 13 2 "H" "e" "l" "l" "o" "," " " "W" "o" "r" "l" "d" "!" copy 1 2 1 copy 2 2 15
99 bottles of beer program
This is a full-lyric 99 bottles of beer program!
copy 1 . tens . prev copy 1 . ones ( + . prev 1 ) swap 4 . keep ( + . keep 5 ) . keep - ones 1 - tens 1 / ( + ( > "0" ones ) ( > "0" tens ) ) 2 / ( + ( > 1 ( - ones "0" ) ) ( > 1 ( - tens "0" ) ) ) 2 swap 4 . keep ( + . keep 5 ) -- ----------------- -- ----------------- -- ----------------- -- ----------------- copy 1 . keep . ones-maths . ones-maths -- ----------------- copy 1 . ones-maths . ones copy ( > "0" ones ) ( + 1 . keep ) . tens-maths . tens-maths -- ---------------- copy ( > "0" ones ) . tens-maths . tens copy 1 ( + 2 . keep ) . end-condition copy 1 ( + 3 . keep ) . plur-condition . end-condition -- ---------------- . plur-condition -- ---------------- copy ( > "0" tens ) . nine . tens copy ( > "0" ones ) . nine . ones copy 1 . tens . current copy 1 . ones ( + . current 1 ) copy 7 . yes-more ( + . linestart 87 ) copy 2 ( + . prev ( > 1 ( - prev "0" ) ) ) . linestart copy 2 ( + . prev ( > 1 ( - prev "0" ) ) ) ( + . linestart 32 ) copy 2 ( + . current ( > 1 ( - current "0" ) ) ) ( + . linestart 87 ) copy ( * 7 plur-condition ) . no-more ( + . linestart 87 ) copy 1 . plural ( + . linestart 9 ) copy 1 . plural ( + . linestart 41 ) copy 1 . plural ( + . linestart 101 ) copy plur-condition . yes-more ( + . linestart 9 ) copy plur-condition . yes-more ( + . linestart 41 ) copy ( / ( + ( > 1 ( - ones "1" ) ) ( > 1 ( - tens "0" ) ) ) 2 ) . yes-more ( + . linestart 101 ) output ( * ( - ( - . ending-line_ . ending-line ) 1 ) end-condition ) . ending-line copy ( * endsize end-condition ) . end 1 output 1 . newline output ( - ( - . linend . linestart ) 1 ) . linestart . linestart "-- bottle- of beer on the wall. -- bottle- of beer, " 10 "Take one down and pass it around, ------- bottle- of beer on the wall" 10 . linend . ending-line 10 "No more bottles of beer on the wall, no more bottles of beer" 10 "Go to the store and buy some more, 99 bottles of beer on the wall" . ending-line_ . end "a 99 bottles of beer program :3 ---------------" . end_ . prev -- --------------- -- --------------- -- --------------- . current -- --------------- -- --------------- -- --------------- . no-more "no more" . yes-more 0 0 0 0 0 0 0 . space " " . newline 10 . nine "9" . zero "0" . tens "9" . ones "9" . plural "s" . endsize - . end_ . end copy ( > ( - tens 48 ) 9 ) . zero . tens